Possible Duplicate:
Bind multiple events to jQuery 'live' method
I have the following function:
$("td.delivered").click(function() {
$(this).html($("<input/>", {
id: 'inp',
style: 'width:80px;',
placeholder: "YYYY-MM-DD",
change: function() {
selectdone(this, title_id, status_type);
},
blur: function() {
selectdone(this, title_id, status_type);
},
onkeypress=="Return": function() { // pseudo-code
selectdone(this, title_id, status_type);
}
})
);
}
The following works, what would be a better way to write it?
change: function() {
selectdone(this, title_id, status_type);
},
blur: function() {
selectdone(this, title_id, status_type);
},
onkeypress: function(e) {
if (e.keyCode == 13) {
selectdone(this, title_id, status_type);
}
}
How would I write this more concisely, making the selectdone
function fire on change
, blur
, and return
?