Reputation:
First of all, I did research on web about my problem but could not find any solution, and that made me to ask the question once again.
I have a select which is registered with change
event , so when i change it on browser event fires but when i try pro-grammatically it does not work.
Select:
<select name="symbol" id="symbol" class='input-xmini'>
<option>-Choose Symbol-</option>
<option value="Categories">Categories</option>
<option value="UpcInfo">UPC</option>
<option value="Transaction">Transaction</option>
<option value="Ticket">Ticket</option>
</select>
Event Registration:
$('#symbol').on('change',function(){
alert('changing symbol')
});
What i tried already:
$('#symbol').val('Categories').trigger('change')
$('#symbol').val('Categories').change()
$(document).on('change','#symbol',function(){}
I need to change it pro-grammatically but this is not working.
Please people dont think i am just another noob who is asking question already asked multiple times.Help. Thanks.
NOTE: I have tried almost everything but it does not work , can someone tell me theoretically why this would not work?
Upvotes: 2
Views: 2342
Reputation: 9738
Your Js may be conflicting, so try this :-
<script>
var jq = jQuery.noConflict();
jq(function(){
jq('#symbol').on('change',function(){
alert('changing symbol');
});
});
</script>
Upvotes: 0
Reputation: 894
I did this over on the function
$("body").on("change","#symbol",function(){
alert('changing symbol')
})
Upvotes: 2