I have a small code where i want to
- check which class is on the element curently.
- change the curent class to the other class
html :
<div class="text-area-box" id="text-area-box">
<input type="text" name="" required="">
<label>Titre</label>
</div>
css:
.text-area-box-active{
position: relative;
}
.text-area-box {
position: relative;
display: none;
}
js (not correct) just a way to show what i want to do :
if(curentClass = text_area_box)
{
element.classList.remove('text-area-box');
element.classList.add('text-area-box-active');
}
else{
element.classList.remove('text-area-box-active');
element.classList.add('text-area-box');
}
how can i make the correct javascript.