AppendTo, does it change the DOM?

Posted by JD on Stack Overflow See other posts from Stack Overflow or by JD
Published on 2010-12-28T22:43:47Z Indexed on 2010/12/28 22:54 UTC
Read the original article Hit count: 169

Filed under:

Hi,

I have two list boxes and some JQuery function that does the following:

 $(document).ready(function () {
    //If you want to move selected item from fromListBox to toListBox
    $("#AddButton").click(function () {
      $("#fromListBox  option:selected").appendTo("#toListBox");
    });
});

I have a button that when clicked moves items from one list to another. This works, however when I do "View Page Source" in chrome, the list contains the original list and not the newly added items.

I expected appendTo to change the DOM but clearly this is not what is happening. Why is this?

JD

© Stack Overflow or respective owner

Related posts about jQuery