Password reveal functionality
Before I comment on your implementation. Your code has a bug in it.

The code inside this if block:

if(modalShowPassword || modalPassword) {


will execute if either modalShowPassword or modalPassword is set but you really only want it to execute if both are set. You want to use the and (&amp;&amp;) operator like this:

if(modalShowPassword &amp;&amp; modalPassword) {


With your code, think about what would happen if you were to have more (say 10) password boxes on your page? Would you repeat your code 10 times with different variables and different values for the data-js attribute? What I would suggest is to use something similar to the Bootstrap style (see how their modal dialogs work here https://getbootstrap.com/docs/4.1/components/modal/#via-data-attributes). There are two things to note. First they use the same data attribute for all instances even if there are multiple modals on the page. Secondly they do not apply an attribute to the modal form. They have two attributes on the toggle button, data-toggle defines the action while data-target tells the button what to show as a modal.

So a solution might look like:

&lt;form&gt;
    &lt;input id="password1" type="password" autocomplete="current-password" name="password" placeholder="Enter Your Password"&gt;
    &lt;a data-js="revealPassword" data-target="#password1"&gt;Show Password&lt;/a&gt;

    &lt;input id="password2" type="password" autocomplete="current-password" name="password" placeholder="Enter Another Password"&gt;
    &lt;a data-js="passwordReveal" data-target="#password2"&gt;Show     
&lt;/form&gt;

&lt;script&gt;
  document.addEventListener("DOMContentLoaded", function(event) {
    var passwordReveals = document.querySelectorAll("[data-js=passwordReveal]");
    Array.prototype.forEach.call(passwordReveals, function (item) {
      var targetSelector = item.getAttribute('data-target');
      if (!targetSelector)
        return;
      var target = document.querySelector(targetSelector);
      if (!target)
        return;

      item.addEventListener("click", function (){
        if (target.type === "password") {
            target.type = "text";
        } else {
            target.type = "password";
        }
      });
    });
  });
&lt;/script&gt;