I´ve got this javascript function working fine for mobile and i need to use it for desktop but the ids of the elements are not the same, i was wondering if someone could give me a hint on how to approach this.
function EventMailing() {
  var email = document.querySelector("#newsletter-popup fieldset #email").value;
  if (email == undefined) {
    email = "";
    if (email == undefined || email == "") return;
  }
  var rgxHome = new RegExp(".*?://(.*)someurl.com($|/|/?(.*))$");
  if (rgxHome.test(location.href)) {
    SendEmail(email);
    document.querySelector("#newsletter-popup fieldset #email").value = "";
    setTimeout(function () {
      $("#newsletter-popup").css("display", "none");
    }, 2000);
}
My Html code for mobile:
<div id="newsletter-popup" >
  <a class="close icon-button-close" href="#"></a>
  <h2>Suscribe to Newsletter</h2>
  <p>some text</p>
  <fieldset>
    <label for="email"> e-mail</label>
    <input id="email" name="email" type="text">
    <button onclick="EventMailing();null">OK</button>
  </fieldset>
</div>
Html code for desktop:
<div id="newsletterPopup" >
  <a class="close icon-button-close" href="#"></a>
  <h2>Suscribe to Newsletter</h2>
  <p>some text</p>
  <fieldset>
    <label for="email"> e-mail</label>
    <input id="emailp" name="email" type="text">
    <button onclick="EventMailing();null">OK</button>
  </fieldset>
</div>
I don't have access to the Html code so im trying to figure out a javascript solution.
 
    