473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

hide/show field using checkbox/checkboxlist

12
Hi I need help with showing field when checkbox checked and hiding field when the checkbox is unchecked.
I was able to do it using dropdownlist but I'm not able to do it with checkboxlist at all. Would you also explain the differences between dropdownlist and checkboxlist. Thanks
This is my code using dropdownlist:
Expand|Select|Wrap|Line Numbers
  1. <script language="Javascript" type="text/javascript">
  2. $(document).ready(function(){
  3.      $("select[@ClientSelector=internetResource]").change(function(){
  4.         show_div_by_class_select(this, "Other", "hidable_other");
  5.     });
  6.  
  7.     show_div_by_class_select($("select[@ClientSelector=internetResource]")[0], "Other", "hidable_other");
  8. });
  9. </script>
  10. <fieldset>
  11.     <legend>Additional Forms</legend>
  12.       <asp:DropDownList ID="ddlInternetResource" runat="server" CssClass="singleColInput" ClientSelector="internetResource">
  13.             <asp:ListItem Value="1">Other</asp:ListItem>
  14.             <asp:ListItem Value="2">Shift 2</asp:ListItem>
  15.             <asp:ListItem Value="3">Shift 3</asp:ListItem>
  16.     </asp:DropDownList>
  17. </fieldset>
  18. <div class="hidable_other" style="display: none;">
  19.  <p>Signature already aquired.  You may resign if you desire.</p></div>
  20.  
Feb 24 '09 #1
1 5085
acoder
16,027 Expert Mod 8TB
You seem to be using jQuery. Anyway, for a checkbox, you can use onclick (click()) or change(), but test the checked property of the checkbox.
Feb 25 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
1
by: mikee | last post by:
I am developing a program using VB.net. It's a web based program that use web controls. When the system display a checkboxlist, I immedately try to put up a popup screen. The problem is before the...
1
by: segue | last post by:
I'm dynamically creating/populating a checkbox list and adding it to a web form. I want to when checking an item in the list have the autopostback retrieve the selected item. I'm dynamically...
0
by: Faybert | last post by:
Hello, and Thanks in advance for any light you might shed on my troubles. I'm trying to setup a series of checkboxes, or a checkboxlist to control the results that are shown on a gridview...
1
by: asilverpeach | last post by:
Hey Guys! Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out. First, In the following code clicking on the headers shows the...
3
by: | last post by:
Hi all, I have a CheckBoxList control which has about 10 items. I have set autopostback=true and also set an eventhandler for OnSelectedIndexChanged. The problem is I want to identify which...
13
by: rupak | last post by:
Hi! I have a multiple selection of checkboxes <input type='checkbox' name='coffee' id='col1' value='Address'/> <input type='checkbox' name='coffee' id='col2' value='Name'/> <input...
0
Frinavale
by: Frinavale | last post by:
This code snippet is just a little bit of fun. It demonstrates how you use JavaScript and CSS to show or hide columns in a table depending on whether or not a checkbox corresponding with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.