jQuery: trying to use prepend() -
i'm trying use prepend() put text before input text.
this try:
but doesn't work..
any idea?
javi
you don't want use prepend, adds given text inside input makes text appear in input. like:
<input type='text'>your text</input>
you need use before creates
your text <input type='text'/>
see jsfiddle
you can this, adds text first item parent of input.
$('input').keypress(function(e) { if(e.keycode == 13) { console.log($(this)); $(this).parent().prepend("<p>fasf</p>"); alert('you pressed enter!'); } });
Comments
Post a Comment