For the life of me, can't figure out why this won't work. Fiddle said it would, even with 2 different method. I tried in both area, Ready and Function. It worked prior to upgrading from JQuery 1.8.3, now it won't work in JQuery 1.9.1.
The head contains:
jquery-1.9.1.js jquery-ui.js (1.9.2) jquery.wijmo-open.all.3.20131.7.js jquery.wijmo-pro.all.3.20131.7.js
$('div[name^="AlSt_"]').click(function(){
var data = $(this).attr('name').split("_");
alert(data[1]);
});
$('div[name^="AlSt_"]').on('click',function(){
var data = $(this).attr('name').split("_");
alert(data[1]);
});
<div name="AlSt_02"><span>02_693</span></div>
It should give me result of "02", but the click/on('click') is not firing on my website.
Thanks in advance for your help!
I think I found a solution after spending hours and hours searching, dunno if it's "proper" idea tho, according to JQuery site:
http://forum.jquery.com/topic/click-event-not-firing-timing-issue
$(document).on('click','div[name^="AlSt_"]',function() {
var data = $(this).attr('name').split("_");
alert(data[1]);
});
So far, tested it and it works. Odd method for sure, but it works :)