0

I have a <div> which is hidden through jquery only inital when the page loads. I have button, in which on the click event the <div> gets visible. I want the <div> to be hidden on the button click event also. I have a event on the button click binding a grid in asp.net.

Following is the code I have tried in which #dInner is the div and #bNextWeek is the button.

$(document).ready(function () {
    $('#dInner').hide();

    $('#<%=bNextWeek.ClientID%>').live('click', function (e) {
         $('#dInner').hide();                                
    });
});
4

4 回答 4

0

Try with this

$('#'+<%=bNextWeek.ClientID%>).live('click', function (e) {
        $('#dInner').hide();                                
});

or you can try with

$('#'+<%=bNextWeek.ClientID%>).live('click', function (e) {
       $('#dInner').css('display','none');
});
于 2013-04-01T10:05:59.217 回答
0

试试这个。我会工作的。

$(文档).ready(函数 () {

    $('#dInner').hide();

    $('#bNextWeek').live('click', function (e) {
        $('#dInner').css('display','none');

    });

});

于 2013-04-01T10:08:29.837 回答
0

如果您试图通过在 jquery 中单击相同的按钮来隐藏和显示 div 元素,请使用切换:
$('#bttnId').bind('click', function () { $('#dInner').toggle( ); });

于 2013-04-01T10:44:48.440 回答
0

CSS:

#dInner
{
visibility:hidden;
}

查询:

 $(document).ready(function () {

    $('#bNextWeek').live('click', function (e) {
    $('#dInner').css('visibility','visible');
    });

  });
于 2013-04-01T10:56:05.633 回答