Reputation: 105
I am just starting with jQuery Mobile I want to create popup.
I found the following example on the jQuery Mobile site:
<a href="#popupBasic" data-rel="popup">Open Popup</a>
<div data-role="popup" id="popupBasic">
<p>This is a completely basic popup, no options set.<p>
<a href="index.html" data-role="button">Link button</a>
<a href="index.html" data-role="button">Link button</a>
</div>
That works very well. What I need now is to change that from an href
to an onClick
function like this below:
<a href="#" onclick="popupBasic" data-rel="popup">Open Popup</a>
Its not working like that. What should I put to onClick
to make it work?
Really appreciate your help.
Upvotes: 0
Views: 79
Reputation: 4239
You can use as below:
Create javascript function :
function openPopUp(){
$('#popupBasic').popup('open');
}
call openPopUp() in click event as below :
<a href="#" onclick="openPopUp()" data-rel="popup">Open Popup</a>
Upvotes: 1