javascript - help with jquery update content in html -
I use jquery ajax to get data from php file.
data = & lt; Option & gt; Peter & lt; / Options & gt; & Lt; Options & gt; Maria & lt; / Options & gt;
I want to use jquery to keep this data after the first option
I can not use HTML () on selection because then the first option will be deleted.
Edit: I can not use the append because then when I make another request and the data is:
data = & lt; Options & gt; Michael & lt; / Options & gt; & Lt; Options & gt; Eric & lt; / Option & gt;
Peter and Maria will still be in the selection list. How can i I have a
& lt; Div id = addhere & gt; & Lt; / Div & gt;
Use the first option and then html () but it does not work. strange. How can I solve it?
Save the original option in a variable and add the AJAX response together with the original option
Work Demo:
(Editable)
Source:
& lt; Id = "name" & gt; & Lt; Options & gt; Name & lt; / Options & gt; & Lt; / Select & gt; & Lt; Script type = "text / javascript" & gt; Choose Var name = $ ('# name'), select the original option = name. hair (); Functions handleJesprons (feedback) {nameSelect.children (). Remove (). the ending (). Attachment (original option.ed (answer)); } $ .get ("getNames.php", handheldspace); & Lt; / Script & gt;
Comments
Post a Comment