Insert text after "this" input-element with javascript? -
Insert text after "this" input-element with javascript? -
code:
<input type="text" onkeydown=" if (event.keycode == 13) { here, echo "ok" right after input element } "> is possible without putting id or name on element? or without encasing in identifiable div?
to clarify, should result html after event keycode pressed:
<input type="text" onkeydown=" if (event.keycode == 13) { here, echo "ok" right after input element } ">ok
if want utilize jquery can following:
html
<input name="ok" type="text" id="showok" /> javascript
$("#showok").keypress(function() { if (event.keycode == 13){ $("<p>ok</p>").insertafter("#showok"); } }); without utilize of id
<input type="text" onkeydown="if (event.keycode == 13) { $('<p>ok</p>').insertafter(this);}"> javascript
Comments
Post a Comment