我想在弹出式(对话框)关闭按钮中更改href
。jQuery Mobile会自动生成href="#"
。我想覆盖href="myPage"
。我如何覆盖href=""
代码
<div data-role="dialog" id="pageId">
<div data-role="header" data-theme="c">
<h2>your Heading</h2>
</div>
<div data-role="content">
<p>Your Message.</p>
</div>
</div>
在此代码中,jQuery会自动为关闭按钮生成代码。如何将href="#"
覆盖到我的href=""
中。
如果我单击"关闭(x)"按钮,则要转到我的链接页面。
任何人都可以帮助我提供良好的解决方案。谢谢
自动生成的关闭按钮通常没有ID。
尝试以下操作:
$('a[title="Close"]').attr("href","http://www.yournewurl.com");
更新
我做了一个快速工作的示例:http://jsfiddle.net/dyb3a/2/
您可以做这个
$('#ElementID').attr("href","http://www.yournewurl.com");