how to add an onKeyUp when creating a element on the fly

i am creating text inputs on the fly. It works but the onkeyup:
need to help on how to add the onKeyUp for the new text area


var cell1 = row.insertCell(0);
var el = document.createElement('input');
el.type = 'text'; = 'cellnum_' + cnt; = 'cellnum_' + cnt;
el.size = 11;
el.maxlength = 10;
el.onkeyup= 'return checkNum(this)';
Who is Participating?

Improve company productivity with a Business Account.Sign Up

KiasChaos83Connect With a Mentor Commented:

el.onkeyup = function() { return checkNum(this); };

For the record, jQuery would have solved your whole problem like this:

      type: 'text',
      name: 'cellnum_' + cnt,
      id: 'cellnum_' + cnt,
      size: 11,
      maxlength: 10,
      onkeyup: function() { return checkNum(this); }
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.