jQuery append based on previous div ID -
ok, supposing have markup:
<div class="ui-sortable ui-droppable" id="ab"> test </div> <div class="the-controls"> <a class="button test-remove" href="javascript:;">remove</a> <a class="button button-primary test-export" href="javascript:;">export</a> </div> <div class="ui-sortable ui-droppable" id="xx"> test </div> <div class="the-controls"> <a class="button test-remove" href="javascript:;">remove</a> <a class="button button-primary test-export" href="javascript:;">export</a> </div>
my problem append new button using jquery under "the-controls" class based id of ui-droppable div.
originally, jquery code:
jquery('.the-controls .test-remove').after('<a class="button-primary test-elements-add-all" href="javascript:;">add all</a>');
it works appends "add all" button 2 divs (#ab , #xx). if append "add all" button link given id of ui-droppable div? illustration id #xx. "add all" added on .the-controls div belonging #xx.ui-droppable. 1 limitation not alter markup allow "the-controls" kid of "xx" or "ab".
i think sounds simple, never work. help. :)
you do:
var _uiid = "xx"; //variable value jquery('#' + _uiid).next('.the-controls').children('.test-remove').after('<a class="button-primary test-elements-add-all" href="javascript:;">add all</a>');
jquery
No comments:
Post a Comment