Select to view content in your preferred language

How do I determine if a Bootstrap Modal is open?

3985
4
Jump to solution
04-23-2015 02:32 PM
ChrisSergent
Deactivated User

I looked up online how to determine if a modal form is open on Bootstrap, so I wrote the following line of code:

console.log($("attributesModal").hasClass('in'));

which provides me with the following error: Uncaught ReferenceError: $ is not definedsubmitIncidentReport @ main.js:228(anonymous function) @ main.js:299

I want to determine which form is entered to run a block of code to insert data in the database based on the open modal form.

1 Solution

Accepted Solutions
TomWayson
Esri Contributor

Is "attributesModal" a class or an id?

If class use something like:

query(".attributesModal .in")

If it's an id, you might want to use dojo/dom-class:

domClass.contains("attributesModal", "in");

Tom

View solution in original post

4 Replies
TomWayson
Esri Contributor

Are you using Dojo-Bootstrap? If so, that's why $ is not defined b/c, there's no jQuery on the page. You can achieve the same w/ dojo/query

Another idea would be for each for submit or button click to call different methods. so you don't have to check which one called it,

0 Kudos
ChrisSergent
Deactivated User

I 'm using your app that I converted. so what would I write? It doesn't look like .hasClass('in)); works.

0 Kudos
TomWayson
Esri Contributor

Is "attributesModal" a class or an id?

If class use something like:

query(".attributesModal .in")

If it's an id, you might want to use dojo/dom-class:

domClass.contains("attributesModal", "in");

Tom

ChrisSergent
Deactivated User

It was indeed the id. Now I can evaluate which form I want to insert data from. The app will now have two layers. Thanks Tom Wayson​ !