add and remove class in javascript

–JS File

window.onload = function(){
	var fixedForm = document.querySelector('.fixed_form');
	var fixedBtn  = document.querySelector('.fixed_form .btn_');
	fixedBtn.onclick = function() {
		if(fixedForm.classList.contains('active')){
			fixedForm.classList.remove('active');
		} else {
			fixedForm.classList.add('active');
		}
		return false;
	}
}

Please Don’t remove window.onload

Leave a Reply

Your email address will not be published. Required fields are marked *