|
[Solved] Trigger a modal popup via a javascript function, not an element
|
|
24th April, 14:14
Post: #1
|
|||
|
|||
|
[Solved] Trigger a modal popup via a javascript function, not an element
Hi,
For the project I am working on, I require to launch a modal popup without an event associated to it. Basically, according to an event that happens in the backend, a javascript function would be executed to show a specific popup. The problem I have is that I do not want an element nor an event associated to it since it is not executed via a button or an html element, it's just a js function which is executed. This code should give you an idea of what im after, I have a couple of comments in there as well LANGUAGE Code
Using the above code, what I need is that by executing a command from javascript such as showmodal('mydivid'), the modal would be triggered showing the contents of 'mydivid' within it. Is this doable? Thanks a lot in advance. |
|||
|
24th April, 15:54
Post: #2
|
|||
|
|||
|
RE: Trigger a modal popup via a javascript function, not an element
Use a dummy div
![]() JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
24th April, 18:58
(This post was last modified: 24th April 19:24 by ganniv.)
Post: #3
|
|||
|
|||
RE: Trigger a modal popup via a javascript function, not an element
(24th April 15:54)Craig Wrote: Use a dummy div Sorry to bug you again, but I dont know exactly what Im supposed to do with this ![]() I tried applying it but nothing happens. I just get a js error that modal is undefined. When i change the '<div/>' to an actual element it still gives an error that it's null. I created a jsFiddle example (although it doesnt work). Please ignore that it is triggered via an onClick event, I did this purely for the test's purposes. In practice I wont execute the JS function from the HTML itself: http://jsfiddle.net/fDavN/3188/ |
|||
|
24th April, 19:59
Post: #4
|
|||
|
|||
|
RE: [Solved] Trigger a modal popup via a javascript function, not an element
See here
http://jsfiddle.net/fDavN/3189/
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
24th April, 20:17
Post: #5
|
|||
|
|||
RE: [Solved] Trigger a modal popup via a javascript function, not an element
(24th April 19:59)Craig Wrote: See here Brilliant dude. Cannot thank you enough for your full support. Will make sure to do a nice donation once the project is over. This library saved us an exceptionally huge amount of time. Thanks again!
|
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)

Search
Member List
Calendar
Help






