views:

799

answers:

3

I need to append some text to an input field...

+6  A: 
$('#input-field-id').val($('#input-field-id').val() + 'more text');
Ayman Hourieh
Thanks a bunch!
Kevin Brown
A: 

You are probably looking for val()

kgiannakakis
+2  A: 

If you are planning to use appending more then once, you might want to write a function:

//Append text to input element
function jQ_append(id_of_input, text){
    $(id_of_input).val($(id_of_input).val() + text);
}

After you can just call it:

jQ_append('my_input_id', 'add this text');

Sorry for not having 50 reputation when posting this, to add comment.

Margus