How to deactivate default bootstrap modal

How to deactivate default bootstrap modal
0.0 0

#1

Hi Campers ,
This is Mohammad Mizanur Rahman a new member for freeCodeCamp forum. I’m developing a Photo gallery Web Application with PHP & MySQL . In front end design part ( menu-option ) I’m facing a problem with default bootstrap modal , I would like to run the modal pop up form by my own script which I coded with javaScript . Please check below :

<script>
<!-- Script For Sign Up Form -->
	var modal2 = document.getElementById('myModal2');
	var btn2 = document.getElementById("myBtn2");
	var span2 = document.getElementsByClassName("close2")[0];
							
		btn2.onclick = function() {
			modal2.style.display = "block";
			modal3.style.display = "none";
		}

		span2.onclick = function() {
			modal2.style.display = "none";
		}

		window.onclick = function(event) {
			if (event.target == modal2) {
				modal2.style.display = "none";
			}
		}
</script>

Actually after closing this form when I clicked on window that time the default “modal-backdrop” class is not working .

Website URL


#2

Why are you not using the built-in modal methods?

$('#myLoginForm').modal('show')
$('#myLoginForm').modal('hide')

https://getbootstrap.com/docs/3.3/javascript/#modals-methods


#3

I tried by using this before posting my topics and I’m trying again

Thank you