Return to Snippet

Revision: 62609
at March 2, 2013 02:51 by mattvbiggs


Initial Code
$('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);
   });
});

Initial URL

                                

Initial Description
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.

Initial Title
jQuery: Double Click to Add

Initial Tags
jquery

Initial Language
jQuery