Reputation: 15362
Is there no way to populate a <select>
list when the <select>
element is clicked on?
$(document).ready(function(){
$("body").on("click", "select", function(){
ajax(); //should append additional <option>s to select
});
});
Is there any solution for loading the content of the <select>
when it is clicked on?
EDIT:
Tried surrounding <select>
with a <div>
and attaching click event to that. No luck.
Upvotes: 1
Views: 133
Reputation: 5399
$("body").on("click", "select", function(){
$(this).children('option:last').insertAfter('<option>Another option</option>');
});
Upvotes: 2