jQuery: trying to use prepend() -


i'm trying use prepend() put text before input text.

this try:

http://jsfiddle.net/sx7jw/2/

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

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -