tags:

views:

28

answers:

1

I have two checkbox and I want when i click on one of them, it to be active. Also I want when I press the second checkbox to hide one input area. How can happen this?

<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-9">

 <title>jquery to Show/Hide a Div</title>
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
 <script type="text/javascript">
 $(document).ready(function(){
    $("#dosya").css("display","none");
    $("#embed").css("display","none");

   $("#checkdosya").click(function(){
     if ($("#checkdosya").is(":checked")){
   $("#dosya").show("fast");
  }else{     
   $("#dosya").hide("fast");
  }
   });

   $("#checkembed").click(function(){
     if ($("#checkembed").is(":checked")){
   $("#embed").show("fast");
  }else{     
   $("#embed").hide("fast");
  }
   });

  });
  </script>
 <style type="text/css">
 <!--
 label {
  display: block;
 }
 -->
 </style>
</head><body>
 <div style="width: 500px;">
  <form style="position: static;">
   <label for="name">Name:</label>
   <input id="name" type="text">
   <label for="checkbox">Check to enter your email address:</label>
   <input id="checkdosya" type="checkbox" name="R1" value="V1">     <input id="checkembed" type="checkbox" name="R1" value="V1">

   <div style="display: none; opacity: 0.9999;" id="dosya">
    <label for="email">Email Address:</label> 
    <input id="email" type="text">
   </div>

    <div style="display: none; opacity: 0.9999;" id="embed">
    <label for="email">Email Address 2:</label> 
    <input id="email" type="text">
   </div>
    </form>
</div></body></html>
A: 

When I click 1 checkbox it opens input area and that's ok. At the same time, when I click the other checkbox it opens second input area and this also is ok. But I want when I click the second checkbox it automatically to disable the first checkbox. I mean when you click one checkbox so the other to be automatically disabled. I hope I could explain :)

gin
Don't reply to your questions, but rather edit it to add more information. Maybe add `EDIT:` at the end to signify that you updated it.
Strelok