Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Natasha 79 posts 195 karma points
    Feb 25, 2014 @ 15:02
    Natasha
    0

    Using javascript to check if a box is checked

    Hi there 

    As our site is currently hosted with another company they are charging huge amounts for any changes I cannot do the obvious option which would be to upgrade.  Until we get out site back (hosted inhouse) I need a work around.

    I am working in umbraco 4.7 and contour 1.something.  I have a form with a tick box for pay now what I want is when the paynow checkbox is checked a link to paypal becomes visable.  So far I have this which works but it shows the alert before the page is loaded how do I get it to

    1. work after the page is loaded and 2. show a link rather than an alert.  I know it's more a javascript question but I'm hoping someone can help.

     

    Thanks in advance

    Natasha

     if($(".contourField checkbox paynow checkbox alternating").attr("checked")==true)
    {
       alert("can you do this after");
    }
    else
    {
        alert("this doesn't work");
    }
       }  
     

     

     

  • Natasha 79 posts 195 karma points
    Feb 25, 2014 @ 15:44
    Natasha
    0

    Code update still have the first problem but have sorted the second:

     <script type="text/javascript">
    window.onload function({    
          if($(".contourField checkbox paynow checkbox alternating").attr("checked")==true)
    {
       window.location '/paypal';
    }
    else
    {
      window.location '#'
    }
       }   
    </script>

     

Please Sign in or register to post replies

Write your reply to:

Draft