I have one variable value
in my jQuery ready function, and I have one HTML input tag. I want this variable to be concatenated to input tag name field. Please help me.
Are you using jQuery ?
You can use $.prop("id") if you are.
supposing value
is the value you need to add
$('selector').attr('name', $('selector').attr('name') + value);
this will do
Since you are using jQuery, try $.attr()
var myName = 'abc';
var $el = $('input[name=xyz]');
$el.attr('name', $el.attr('name') + myName);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.