html - Show select div by button with Javascript -


i need help, when click button show select div, "id" generated php, returns null response in console. need show div when click on "cita rápida" button.

here code:

function muestracita(id) {    var ident = document.getelementbyid(id);    ident.classlist.add("showing");  };
.showing {    background: #fff none repeat scroll 0 0;    display: block;    left: 0;    max-width: 300px;    padding: 3%;    position: fixed;    top: 0;  }
<div class="cr-clase">    <div class="cr-options">      <img title="proponer cita rápida" alt="cita rápida" src="/wp-content/uploads/2016/06/cita-rapida-icon.gif">    </div>    <div class="button" onclick="muestracita(cr21);">cita rápida</div>    <div id="cr21" class="formdate">      <form onsubmit="return validacioncita();target_popup()" action="/../../controladores/grabarglobal.php" target="done" method="post">    </div>  </div>

the problem

onclick="muestracita(cr21);" 

written that, cr21 treated variable has no value, need pass string muestracita()

you missing quotes. try:

onclick="muestracita('cr21');"