Tag: Javascript

How to: dynamically add input field in form, using Javascript

Recently I ran across this issue on a project. Whereas I need to employ a html textarea when needed (dynamic), plus the delete link. These is the Javascript part: function addElement(fieldType, fieldName, className, ctrl1, ctrl2) { var ni = document.getElementById(ctrl1); var numi = document.getElementById(ctrl2); var num = (document.getElementById(ctrl2).value -1)+ 2; numi.value = num; var divIdName = ctrl1+num; var newdiv =…

Read More »