Connect with us

javascript – how to add and remove classes in JS without jquery

You can use below code if you want to add and remove classes in JS without jquery:

var select = document.getElementById("section").value;
	
if(select == 'popup'){
      document.getElementById("form").classList.add("montx_enabled");
	  document.getElementById("justforpoupvisiable").value = 1;
	  
		
	}else{
	    document.getElementById("poupvisiable").value = 0;
		document.getElementById("form").classList.remove("montx_enabled");
		
	}

Your Answer

Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.

Log In

Subscribe to our newsletter

Enter your email address to subscribe to blog and receive notifications of new articles by email.
100% Privacy. No spam guaranteed