When you address an element in jquery by its id, its DOM position doesn’t really matter, because an id is a unique attribute. If you get errors with that there are reasons like:
the id of your element is not unique ///to fix that make it unique
there is no value attribute ( if you have $(’#…’).val() ) ///to fix that give your input a value
the code is operated before the DOM is formed. /// to fix that either place your script block in the end of the document, or wrap your code with $(document).ready(function () { … }) .
In fact I came across problems with older IE versions to behave well with $(’#…’) - addressing elements by id. So addressing it by classes or other attribute or filter can solve it. But in this case we need to remember that class is not a unique attribute. So for you case it can be like this: $(’#new’).children(‘input[type=“text”]’).val() , but even better, (if your form is the only one on the page) is $(‘form’).children(‘input[type=“text”]’).
in your example you use div with ids. I’d better give them unique classes instead. In that case I could be safe from IE6 issues.
jquery is a very flexible library, so experiment with it and good luck.