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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -