This is my code为什么Id值在Jquery中没有附加Id?
我所期待的 <input type="text" name="procedurecode1" id="procedurecode1" value="">
但结果类似下面
<input type="text" +idvalue="" name="procedurecode" id="procedurecode" value="">
我不知道为什么?在此先感谢。
This is my code为什么Id值在Jquery中没有附加Id?
我所期待的 <input type="text" name="procedurecode1" id="procedurecode1" value="">
但结果类似下面
<input type="text" +idvalue="" name="procedurecode" id="procedurecode" value="">
我不知道为什么?在此先感谢。
我不知道你想要什么,但它:link
你失踪单引号和+
。 Here is the modified version。
固定码:
$("#procedurecontainer").append('<input type="text" value="" id="procedurecode"'
+ idvalue + 'name="procedurecode"' + idvalue + '></input>');
我觉得你的报价转义是越来越糊涂了。
应该更多这样的:
你需要,当你把你的变量在单引号逃脱
$(document).ready(function() {
$('#addprocedure').click(function()
{
//alert($("#maxprocedure").val());
var maxvalue=$("#maxprocedure").val();
for(var i=1;i<=5;i++)
{
var idvalue=parseInt(maxvalue)+i;
$("#procedurecontainer").append('<input type="text" value="" id="procedurecode'+idvalue+'" name="procedurecode'+idvalue+'" />');
$("#maxprocedure").val(idvalue);
}
});
});