Monday, June 3, 2024
35
rated 0 times [  36] [ 1]  / answers: 1 / hits: 71013  / 11 Years ago, tue, june 25, 2013, 12:00:00

i am using a salesforce platofrm.in which i have access to only onclick function of a button .i have to launch a modal like this code



<!-- Button to trigger modal -->
<a href=#myModal role=button class=btn data-toggle=modal>Launch demo modal</a>

<!-- Modal -->
<div id=myModal class=modal hide fade tabindex=-1 role=dialog aria-labelledby=myModalLabel aria-hidden=true>
<div class=modal-header>
<button type=button class=close data-dismiss=modal aria-hidden=true>×</button>
<h3 id=myModalLabel>Modal header</h3>
</div>
<div class=modal-body>
<p>One fine body…</p>
</div>
<div class=modal-footer>
<button class=btn data-dismiss=modal aria-hidden=true>Close</button>
<button class=btn btn-primary>Save changes</button>
</div>
</div>


instead of setting these attributes href=#myModal role=button class=btn data-toggle=modal



how to show modal when user click on the link using onclick function of javascript please guideline


More From » twitter-bootstrap

 Answers
18

On click of the button you can use the show method as given in the documentation



$('#myModal').modal('show')


Demo: Plunker


[#77434] Sunday, June 23, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
colby

Total Points: 311
Total Questions: 102
Total Answers: 102

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;