admin管理员组文章数量:1026989
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"));
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"));
本文标签: JavaScriptJQueryhow append field value to idStack Overflow
版权声明:本文标题:javascript - Jquery , how append field value to id - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1744590940a2105499.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论