I just need to accept the value in the text box when enter key is pressed. But seems so tough to achieve. I am trying to call the additemkey function when enter key is pressed in the text box.
var x = document.createElement("input");
x.setAttribute("id", string);
x.setAttribute("type", "text");
x.setAttribute("style", "max-width:207px;");
x.addEventListener(onkeypress, additemkey(this), false);
In additemkey function I am trying to check if e.which is 13 (return key) and if so, call the actual add item function.
Is this the right approach? Thanks so much.
karthika