Day Posted June 27, 2014 Share Posted June 27, 2014 I have a script that is using cloneNode to add fieldsets to a form. After I use cloneNode, I'm attempting to search through the new node's children to change id attributes, however nextSibling is returning an empty text node instead of the fieldset.After the first one is cloned, the and I clone the second, nextSibling begins to return a fieldset. Im not sure why the first one won't work.Can anyone offer some insight? Link to comment Share on other sites More sharing options...
dsonesuk Posted June 27, 2014 Share Posted June 27, 2014 depending on browser any newline (return carriage) or space will be treated as text node and nextSibling will count that as sibling, use .children() instead, it will only look at elements and ignore text nodes completely. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now