Home:ALL Converter>How to open bootstrap modal as soon as page opens if modal id is present in url #

How to open bootstrap modal as soon as page opens if modal id is present in url #

Ask Time:2013-02-26T21:16:33         Author:Dhruv Kumar Jha

Json Formatter

Is there any way using which when a user opens a url http://www.website.com/page/#delete-page and if that page has a twitter bootstrap modal with same id delete-page it should open instantly.

So in theory the user opens the url, The page loads and after its successfully loaded the modal opens (i..e if it exists if not then nothing happens)

Author:Dhruv Kumar Jha,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/15090084/how-to-open-bootstrap-modal-as-soon-as-page-opens-if-modal-id-is-present-in-url
Pigueiras :

What do you need?\n\n\nGet the hash from the URL: How can you check for a #hash in a URL using JavaScript?\nOnce you have the hash, simple get the element with the id selector of the hash and then:\n\n$(hash).modal('show')\n\n",
2013-02-26T13:39:58
yy