0

Here is my Javascript which is working initialyy and not working after a postback.

 <script type="text/javascript">
$(document).ready(function(){
    $('input[type="checkbox"]').click(function(){
        if($(this).attr("value")=="cash"){
            $(".cash").toggle();
        }
        if($(this).attr("value")=="cheque"){
            $(".cheque").toggle();
        }
        if($(this).attr("value")=="dd"){
            $(".dd").toggle();
        }
    });
});
</script>

enter image description here

SRJ
  • 198
  • 1
  • 4
  • 22
  • Where have you put the javascript? Are you creating the javascript dynamically and rendering it from code behind? – unlimit Nov 12 '13 at 05:32
  • Javascript is in same page. am not rendering it in codebehind. i am using this to make a div visible and invisible by checkbox tick.
    cash is checkbox and bigbox is css for div
    – SRJ Nov 12 '13 at 05:42
  • Ive done this to Solve the problem. http://stackoverflow.com/questions/256195/jquery-document-ready-and-updatepanels – SRJ Nov 12 '13 at 05:54

1 Answers1

0

Try like this

$('input[type="checkbox"]').on('click', (function () {
if($(this).attr("value")=="cash"){
        $(".cash").toggle();
    }
    if($(this).attr("value")=="cheque"){
        $(".cheque").toggle();
    }
    if($(this).attr("value")=="dd"){
        $(".dd").toggle();
    }
});

or you can use change event also

abc123
  • 262
  • 4
  • 27