我有一个jQuery通知。当我单击通知时,它应该转到预期的页面。
在PHP中,我们可以通过执行以下操作来实现。
$link = 22;
echo "<a href=\"page2.php?id=link\">Click to read more</a>";
如何在JQuery中实现?我有通知弹出,链接变量准备好了。
var link = "home.php?destination=22";
您可以使用jQuery创建HTML元素
var link = "home.php?destination=22";
//Create anchor element
var anchor = $('<a />', {
"href": link,
"text": "Click to read more"
})
//Append the element
$('#dialog').append(anchor).dialog();
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<div id="dialog" title="Basic dialog">
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句