I need to append some text to an input field...
From stackoverflow
-
$('#input-field-id').val($('#input-field-id').val() + 'more text');Kevin Brown : Thanks a bunch! -
You are probably looking for val()
-
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.
0 comments:
Post a Comment