I need to append some text to an input field...
+6
A:
$('#input-field-id').val($('#input-field-id').val() + 'more text');
Ayman Hourieh
2009-05-08 20:50:22
Thanks a bunch!
Kevin Brown
2009-05-08 20:59:32
+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
2009-05-08 21:00:58