Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js " type="text/javascript"></script>
<script src="/Script.js " type="text/javascript"></script>
<script src="/Script2.js " type="text/javascript"></script>
</head>
<body>
<input id="myID" type="text" value="click on the button"></br>
<button type="button">click</button>
</body>
</html>
// this will be placed in Script.js
(function ($) {
$.fn.ToggleInput = function (myattr) {
if (myattr == "text") {$(this).attr("type", "password")}else{$(this).attr("type", "text")}
return this;
};
})(jQuery);
// this will be placed in Script2.js
$(document).ready(function () {
$("button").click(function () {
var myattr = $("#myID").attr("type");
$("#myID").ToggleInput(myattr);
});
});
The most helpful JQUERY solutions