Good morning, I am trying to show a modal when loading a page taking a reference class, what I want to achieve is to show the modal on only one page and not on the others, what occurs to me is to take a reference class and show the modal if that class exists on the page
$(document).ready(function () {
document.getElementById('hoteles').load( function() {
//$(window).load(function(){
$('#myModal').modal('show').delay(30000).fadeOut('fast');
});
)};
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
I was trying to do it like this but it gives me an error obviously
You shouldn't just mix Javascript with jQuery, try doing something like:
That way, if there isn't an element with the id (or class)
hoteles
, it just won't do anything, but it won't throw an error.