jquery - General Dynamic Selectbox Question -


this general question...i'm in process of trying figure out how fire event (call function) populate select (dropdown) options once user clicks on it. core question is: how can fire event when select (or similar) clicked...without firing event again on change (on select...when user chooses something)?

$(function() {     var options = ["the", "brown", "fox", "jump"];     $('#create-select').click(function(e) {         e.preventdefault();         var select = '<select id="select-create">\n';         $.each(options,function(i, item) {             select += '<option ' + (i === 0 ? 'selected': '') + ' value="' + item + '">' + item + '</option>\n';         });         select +=  '</select>';          $(this).fadeout(200,function (){          $(select).insertafter(this);                $(this).remove();              });     });     $('#select-create').live('change',function() {         alert($(this).val())     }); }); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -