我正在尝试为fancybox发生onClose事件时单击按钮。 我想我只是有语法问题,但我不完全确定。这是我的代码。 :
<script type="text/javascript">
var $_returnvalue = false;
$(document).ready(function () {
$(".stopNumberLnkItem").fancybox({
'width': '85%',
'height': '85%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'speedIn': 400,
'speedOut': 400,
'type': 'iframe',
'showCloseButton': true,
'onClosed': function () {
if ($_returnvalue = 'Y') {
$('#Chkbxaddto').attr('checked', 'checked');
}
$(".gridStopSelectorListLnkItem").trigger('click');
}
});
});
</script>
这是我尝试通过上面的触发器(“点击”)点击的链接按钮。 :
<asp:LinkButton runat="Server" ID="RefreshGridStopListButton" Text="Refresh Grid Stop List" CssClass="gridStopSelectorListLnkItem"
OnClick="RefreshGridStopListButton_Click" Font-Size="smaller" Visible="true"/>
我一直在尝试不同的选择器和不同的方式来执行点击但无济于事。我已经使用IE开发人员工具,但它似乎没有点击该按钮。对此的任何想法都将不胜感激。
感谢。
答案 0 :(得分:0)
取决于如何在HTML中呈现链接按钮。如果它是<button>
或者我认为也是<input type='button'>
那么你可以$(".gridStopSelectorListLnkItem").click()
但是如果它是<a>
则不确定click()是否适用于那个(但你可以尝试)