Attach event handler to jquery object
Hi guys,
Just started using jquery :)
I want to create an html element wrapped in a jquery object like so...
var s = $("<select id='resType'>" +
"<option value='Yes'>Yes</option>" +
"<option value='No'>No</option>" +
"<option value='NA'>N/A</option>" +
"</select>");
And then attach an event handler for when the selected index is changed, like so...
s.change(function () {
alert("!");
});
This code doesn't work (in chrome and IE 11). Any suggestions greatly appreciated.