• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Bootstrap 4 modal on page load sans jquery?

I am having great difficulty displaying a modal on page load, using Bootstrap 4. Here is the code for the modal...it comes directly from online resources:

   

I thought by adding an "id" name for the modal and using "style="display: block" I could control the display using pure Javascript. For example in my external ("logic") file:

addEventListener("load", initialize);    function initialize() {  var _warning = document.getElementById("cookieModal");  //for cookie modal display on page load... _warning.style.display = "block";  //show the cookie modal...  } 

However the modal does not seem to display. Can anybody give some advice WITHOUT using JQuery...just pure JS would be great. I dislike JQuery and do not use it. I thank you in advance.

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]

Bootstrap 4 modals require jQuery. Just changing the display property is not enough.

If you don't want to use jQuery, use the latest version of Bootstrap (5.0.0), which does not require jQuery for anything.

see demo
  • 0
Reply Report

If i got your question this will work; Using jquery;(sorry for using jquery but this is how the bootstrap is showing to do.)

 $(document).ready(function() {     $('#cookieModal').modal('show'); //If you want to hide it automatically after 5 secs.     setTimeout(function() {       $("#cookieModal").modal('hide');     }, 5000);   }); 
demo
  • 0
Reply Report