I have this snippet of jQuery used to get an ID number from an input field
$('table th input').change(function() {
var id = $(this).attr('id');
id = parseInt(id);
id = isNaN(id) ? 0 : id;
alert(id);
});
the ID's of the fields are along the lines of 'col2Name' etc, and I want to just grab the 2 from there, for some reason in my alert i am always getting 0, now when i try to just do:
alert(parseInt('12978sdkjfhakj'));
I get the appropriate response of 12978, why is this not working?