Rewrite inline javascript into jQuery -


How can I use jQuery instead of this anecdote?

  & lt; Input name = "password name" type = "password" id = "passwordID" & gt; & Lt; P & gt; & Lt; Input type = "checkbox" onchange = "document.getElementById ('passwordID'). Type = this.checked? 'Text': 'password'" & gt; Show password & lt; / P & gt;  

If this is your correct markup, then you can do this. Also keep in mind that it has actually been updated to work in different browsers. Since your checkbox currently does not contain any IDs, I use my parent p tag:

  jQuery (function ($) {/ "text": "password" , Pwd = $ ("#"), "password", "password id"); // If we keep changing it, then find it again (pwd.attr ('type')! == new_type) {pwd.replaceWith ($ (" & gt;", {type: new_type , Value: pwd.val (), id: "passwordID", name: "password name"})));}}). Click (); After remembering the browser on the settings, trigger it once upon loading);  


Comments