How to stack automatically generated js elements and original page elements. js automatically generates
Product attributes and product specifications are the elements dynamically generated by js. The two text boxes of product extension information are original elements, which are stacked, I thought it was because the size of the div where the generated element is located is not fixed, because the check boxes below the product specification are generated by the second ajax, I doubt whether ajax cannot push the original elements of the page down to a proper position for the second time.
After several hours, I tried to fix the size of the div in the container where the element is located, but it is not fixed. The number of elements is not fixed. I tried to change the order of generating attributes and specifications, the property part is piled up to the specification part. Why are the elements of the Specification Part not independent of each other? Later I thought it would be a floating, removing the floating, and giving the original elements (product expansion information part) with clear: both;, it is normal.
Don't be alarmed when encountering problems, don't be afraid of troubles, and handle them slowly.
Js traverses all elements on the current page and obtains the elements with the title attribute.
Function getHasTitles (parentNode) {var allNodes = parentNode. getElementsByTagName ('*'); var length = allNodes. length; var I; var hasTitles = []; var node; for (I = 0; I <length; I ++) {node = allNodes [I]; if (node. title) {hasTitles. push (node) ;}} return hasTitles;} var hasTitles = getHasTitles (document );
Jquery gets all elements
$ ("*")
How to obtain page elements in JS
Well, the upstairs is correct. In this way, an error is prompted in the advanced HTML editor. Because it does not conform to the standard, the ID name must be unique.
We recommend that you:
<Div id = "menu1">
<Div class = "menu"> </div>
</Div>
<Div id = "menu2">
<Div class = "menu"> </div>
</Div>
GetElementById ("menu1"). childNodes [0]. inerText = "content"