javascript - Need to append text to beginning of input field. -
in following code, send text server, want username appended beginning of field. ideas on how can done? prototype solution below.
function chatsend(){ console.log(input.value) input.value = name+":"+input.value; // $.ajax({ type: "post", url: "https://api.parse.com/1/classes/chats", data: json.stringify({text: $('input').val()}), success:function(message){ } }); }
did not work? wrote , works fine:
chatsend($('.inp')); function chatsend(input){ console.log($(input).val()) $(input).val("username" + ":" +$(input).val()); console.log($(input).val()) }
Comments
Post a Comment