0
rated 0 times
[
3]
[
3]
/ answers: 1 / hits: 15433
/ 11 Years ago, thu, october 10, 2013, 12:00:00
I create the same inputbox a couple of times dynamically. When a user presses enter it calls a function. I then test with this code:
function insertComment(){
alert($(this).attr('id'));
}
But it keeps returning undefined. Here is the syntax I use to create similiar input boxes:
$(#divToAppend).append(<input id='testID' type = 'text' class = 'formatCSS' style = 'margin-top:12px ; ' placeholder = 'Add Comment' onkeydown='if (event.keyCode == 13) insertComment()'></input>);
More From » jquery