开发者

How to show <tr> tag on clicking button and prevent page refresh

开发者 https://www.devze.com 2023-03-18 11:32 出处:网络
My Requirement is to hide atag initially, if user clicks forwardbutton without checking any radio or checkbutton we have show thetag and have to prevent page refresh. But it is permanently not submitt

My Requirement is to hide a tag initially, if user clicks forwardbutton without checking any radio or checkbutton we have show the tag and have to prevent page refresh. But it is permanently not submitting on click, Plese someone help me.

$(document).ready(function()
{
var y=$('input').filter(':checked').length;
alert(y);
if(y == 0 )
{
   $('#Q1_7_label').parents('TR').hide();       
}
$('#forwardbutton').live('click',function(event)
 {
    var x=$('input').filter(':checked').length;
    if(x开发者_如何学C==0)
     {
      $('#Q1_7_label').parents('TR').show(); 
      return false;
     }
 });

});


$('#forwardbutton').live('click',function(event)
 {
    var x=$('input').filter(':checked').length;
    if(x==0)
     {
      $('#Q1_7_label').parents('TR').show(); 
      return false;
     }
     return true;
 });

Just add return true at the end of the function


Try to replace

return false;

with

event.preventDefault();
0

精彩评论

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