/ Published in: jQuery
The snippet below was pulled from code that loads a list of names pulled from Active Directory into a listbox. This code will execute when the user double clicks on a name in the list box (lstResults) and stores it in a variable to be passed to another function (to populate fields on the page).
This code was used on an ASP .NET page which is why you see the syntax "id$=" for finding the DOM objects. This syntax is used to ignore the ClientID value the .NET Framework adds to DOM objects at runtime.
Expand |
Embed | Plain Text
$('select[id$=lstResults]').dblclick(function () { $('select[id$=lstResults] option:selected').each(function () { var sname = $('select[id$=lstResults] option:selected').text(); var uid = $('select[id$=lstResults] option:selected').val(); ItemSelected(sname, uid); }); });
You need to login to post a comment.
