Using
$("#input_text").appendTo("#somediv")
Appends the text field itself, I want to append it's value entered by user not itself.
Or if there a way to just use something like ""+valueoffield+", bla bla".
How should I do this?
Thanks.
Using
$("#input_text").appendTo("#somediv")
Appends the text field itself, I want to append it's value entered by user not itself.
Or if there a way to just use something like ""+valueoffield+", bla bla".
How should I do this?
Thanks.
Share Improve this question asked Jul 17, 2013 at 22:19 Blessing ThinkerBlessing Thinker 2711 gold badge4 silver badges14 bronze badges 1- Append the value of a text field, not the text field itself. – Blessing Thinker Commented Jul 17, 2013 at 22:28
3 Answers
Reset to default 5If you need to append the value of your input to #somediv
, what you need to do is:
$( "#somediv" ).append( $( "#input_text" ).val() );
$("#somediv").append($("#input_text").val());
If you would like to keep using appendTo
. You have no option but to use it with some html tag when appending.
$('<span>' + $('#textbox').val() + '</span>').appendTo('#foo');
Try this :
<div id="append">
js:
var append_photo='<img src="{@user_image}" class="img-thumbnail" alt="Thumbnail Image"style="width:125px; height:125px">';
$("#append").append(append_photo.replace("{@user_image}","image/profile_thumb.jpg"));