javascript - JScript Button working in chrome but not in Firefox -
I have a script that adds properties when basically clicking a button. The script is as follows;
& lt; Script type = "text / javascript" & gt; Window.generateRow = function () {var d = document.getElementById ("Add"); Var p = document.createElement ("p"); Var input = document.createElement ("input"); Input.setAttribute ('type', 'text'); Input.setAttribute ('Pattern', '^ [a-zA-Z] + $'); Input.setAttribute ('name', 'item []'); Input.setAttribute ('required'); P.appendChild (input); D.appendChild (P); } & Lt; / Script & gt;
And in my HTML I use a normal onclick function to call back the function
& lt; / p & gt;
The problem I have is that of Chrome In my version of, I am able to click the button every time, but the button does not respond in the updated version of Firefox and Chrome
I am using Firefox version 31.0 and I have Chrome version 32.0
node element
method setAttribute
Two ways , But the line input.setAttribute ('required')
is only one.
after the generRow = function you get the input.setAttribute ( 'Required', true);
. () {alert ('m'); var d = document.getElementById ("add"); var p = document CreateElement ("p"); var input = document.createElement ("input"); Input.setAttribute ('type', 'text'); Input.setAttribute ('pattern', '^ [a-zA-Z] + $ '); Input.setAttribute (' name ',' item [] '); Input.setAttribute ('required', true); P.appendChild (input); D.appendChild (P); }
Comments
Post a Comment