admin管理员组文章数量:1332351
I have:
<div data-role="page" class="type-interior">
<div data-role="content" class="ui-body">
<a href="#transitionExample" data-role="button" data-rel="popup">
Pop Up
</a>
<div data-role="popup" id="transitionExample">This is a POP UP.</div>
<a href=# onClick="$('transitionExample').popup('open')"
data-rel="popup">OpenPopUp</a>
</div>
</div>
If I click on Button It Works, but if I use Javascript method .popup('open'), nothing happens. Popup is not showed.
What is happening? I use, JqueryMobile 1.2.0 and JQuery 1.8.2.
I have:
<div data-role="page" class="type-interior">
<div data-role="content" class="ui-body">
<a href="#transitionExample" data-role="button" data-rel="popup">
Pop Up
</a>
<div data-role="popup" id="transitionExample">This is a POP UP.</div>
<a href=# onClick="$('transitionExample').popup('open')"
data-rel="popup">OpenPopUp</a>
</div>
</div>
If I click on Button It Works, but if I use Javascript method .popup('open'), nothing happens. Popup is not showed.
What is happening? I use, JqueryMobile 1.2.0 and JQuery 1.8.2.
Share Improve this question edited Jan 21, 2013 at 11:42 JohnJohnGa 15.7k20 gold badges64 silver badges87 bronze badges asked Jan 21, 2013 at 11:32 ManuParraManuParra 1,5316 gold badges18 silver badges33 bronze badges2 Answers
Reset to default 5$('transitionExample').popup('open')
should be
$('#transitionExample').popup('open')
for more info see: http://api.jquery./id-selector/
then you better bind your link in the .ready(), you should try to avoid Javascript
code in the DOM
for better maintainability.
<a href='#' id='myButton' data-rel="popup">OpenPopUp</a>
and between your <script></script>
tags
$(function () {
$("#myButton").click(function () {
$('#transitionExample').popup('open');
});
});
I ran into this thread whilst trying to find the reason for precisely the same behavior - clicking on a data-rel='popup' link was working but the popup() method was not showing anything. After much frustration I eventually discovered that the issue was down to the fact that I had coded
$('#popupid').popup(open)
NO QUOTES! No one plained - Chrome did not throw up an error but the popup call did nothing.
Hopefully, this will help someone else one day.
本文标签: javascriptjquerymobile popup function is not working in the onClickStack Overflow
版权声明:本文标题:javascript - jquerymobile popup function is not working in the onClick - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742321461a2452871.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论