I want to set the attribute 'maxlength' for my dynamically added rows. But it is not possible for me do it. var currCell = document.createElement("TD"); var currText = document.createElement("input"); currText.setAttribute("name","mszDescription"); currText.setAttribute("type","text"); currText.setAttribute("id",currRows); currText.setAttribute('maxlength','20'); currCell.appendChild(currText); currRow.appendChild(currCell); I am not able to set the maxlength attribute for dynamically added rows. All other attributes are posible to set. Please send a solution with some piece of code.