Can jQuery selectors be used with DOM mutation observers?

Yes, you can use jQuery selectors on data returned to mutation observer callbacks. See this jsFiddle. Suppose you had HTML like so and you set an observer, like so: var targetNodes = $(“.myclass”); var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; var myObserver = new MutationObserver(mutationHandler); var obsConfig = { childList: true, characterData: true, attributes: true, subtree: … Read more

How do I POST an array of objects with $.ajax (jQuery or Zepto)

Be sure to stringify before sending. I leaned on the libraries too much and thought they would encode properly based on the contentType I was posting, but they do not seem to. Works: $.ajax({ url: _saveAllDevicesUrl , type: ‘POST’ , contentType: ‘application/json’ , data: JSON.stringify(postData) //stringify is important , success: _madeSave.bind(this) }); I prefer this … Read more

How to Set Selected value in Multi-Value Select in Jquery-Select2.?

Well actually your only need $.each to get all values, it will help you jsfiddle.net/NdQbw/5 <div class=”divright”> <select id=”drp_Books_Ill_Illustrations” class=”leaderMultiSelctdropdown Books_Illustrations” name=”drp_Books_Ill_Illustrations” multiple=””> <option value=” “>No illustrations</option> <option value=”a” selected>Illustrations</option> <option value=”b”>Maps</option> <option value=”c” selected>selectedPortraits</option> </select> </div> <div class=”divright”> <select id=”drp_Books_Ill_Illustrations1″ class=” Books_Illustrations” name=”drp_Books_Ill_Illustrations” multiple=””> <option value=” “>No illustrations</option> <option value=”a”>Illustrations</option> <option value=”b”>Maps</option> <option value=”c”>selectedPortraits</option> … Read more