I have an icon which needs to put the password_field that it is in to a textfield and vise versa.
<i class="password_icon fa fa-unlock" aria-hidden="true" onmouseover="mouseOverPassword()" onmouseout="mouseOutPassword()"></i>
Uncaught ReferenceError: mouseOutPassword is not defined
at HTMLElement.onmouseout ((index):1)
function mouseOverPassword() {
var obj = $("#passworldField");
obj.type = "text";
}
function mouseOutPassword() {
var obj = $("#passworldField");
obj.type = "password";
}'
When the functions are scoped into another one, in your case in the $(document).ready
they are not visible directly into the html. You need to bind them via Javascript. Get your element by id
or name
or something else and attach via that approach.
<i id="iEl" class="password_icon fa fa-unlock" aria-hidden="true"></i>
...
$('#iEl').on('mouseover', mouseOverPassword);
$('#iEl').on('mouseout', mouseOutPassword);