[英]How To Concatenate JavaScript Value to HTML Input 'name' Field?
I have one variable value
in my jQuery ready function, and I have one HTML input tag. 我有一个变量
value
在我的jQuery就绪功能,我有一个HTML输入标记。 I want this variable to be concatenated to input tag name field. 我希望将此变量连接到输入标签名称字段。 Please help me.
请帮我。
Are you using jQuery ? 您正在使用jQuery吗?
You can use $.prop("id") if you are. 您可以使用$ .prop(“ id”) 。
supposing value
is the value you need to add 假设
value
是您需要添加的值
$('selector').attr('name', $('selector').attr('name') + value);
this will do 这会做
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.