0

I am using a modal plugin that I discovered from here that works great for my application. I make the modal appear by linking to it this way:

<a href="#myDiv" rel="modal:open">Make Modal Appear</a>

However, I'd like to use the onclick event with a button to make the same plugin work but I can't figure out how to use the "rel=modal:open" code with the onclick event. Without "rel=" command in there, the plugin won't function properly. Any help would be greatly appreciated.

1 Answer 1

2

If you mean you want an additional button to do open the modal then you could do something like this:

<a id="modal-open" href="#myDiv" rel="modal:open">Make Modal Appear</a>
<button id="another-modal-open" onClick="$('#modal-open').trigger('click');">Also Opens Modal</button>

DEMO: http://jsfiddle.net/aag1wer9/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.