开发者

concatinating 1 string and an int value while giving id value to a <button> field which is generated dynamically in HTML

var bu开发者_高级运维t = document.createElement('span');

        but.innerHTML.id="but1"+inc;

        but.innerHTML = '<button value="delete row" id="'but'+inc"  
onclick="deleteRow(this.id)">delete row</button>';

// '"but"+inc' , "but+inc" are not working

//here inc is an integer value which increments by one


this is wrong

  but.innerHTML.id="but1"+inc;

this is how it should be

  but.id="but1"+inc;

  but.innerHTML = '<button value="delete row" id="but'+inc+'" onclick="deleteRow(this.id)">delete row</button>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜