开发者

Show() not working in jQuery?

开发者 https://www.devze.com 2023-03-18 08:13 出处:网络
<scripttype=\"text/javascript\"> //Code added by Nitesh for RFE 670082 starts here jQuery(\"input[name=\'hideLineItemColumns_quote\']\").click(function () {
<script  type="text/javascript">

//Code added by Nitesh for RFE 670082 starts here
    jQuery("input[name='hideLineItemColumns_quote']").click(function () {
        alert(jQuery(this).attr('checked'));
    if(jQuery(this).attr('checked')){
            var columnName = $.trim($(this).val()).replace('\u00a0','');

        $('thead.line-item-grid-header tr th').filter(function () 
            {
                if($.trim($('div', this).text()).replace(' ','') == columnName){
                    indexValue = $(this).index();
                    //Hiding body columns
                    jQuery('.line-item-grid-body').children('tr').each(function(){
                        jQuery(this).children('td:eq('+indexValue+')').hide();
                    });
                    //Hiding footer columns
                    jQuery('.line-item-grid-footer').children('tr').each(function(){
                        jQuery(this).children('th:eq('+indexValue+')').hide();
                    });
                    return true;
            };
        }).hide();
     }
     else{
            var columnName = $.trim($(this).text()).replace('\u00a0','');

        $('thead.line-item-grid-header tr th').filter(function () 
            {
                if($.trim($('div', this).text()).replace(' ','') == columnName){
                    indexValue = $(this).index();
                    //Showing body columns
                    jQuery('.line-item-grid-body').children('tr').each(function(){
                        jQuery(this).children('td:eq('+indexValue+')').show();
                    });
                    //Showing footer columns
                    jQuery('.line-item-grid-footer').children('tr').each(function(){
                        jQue开发者_高级运维ry(this).children('th:eq('+indexValue+')').show();
                    });
                    return true;
            };
        }).show();
     }
});


Change

if(jQuery(this).attr('checked')){

to

if(jQuery(this).is(':checked')){
0

精彩评论

暂无评论...
验证码 换一张
取 消