Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 648
  • Last Modified:

show/hide DIV based on checkbox click

I have a checkbox in my form. If the checkbox is checked, I need to show a div tag. If it is unchecked, I need to hide the div tag.

Please help.

  • 2
1 Solution
sshivannaAuthor Commented:
sorry, I need to accomplish this using Jqeury.
Thank you
I hope u have only one chk box.

<input type="checkbox" name="foo" value="bar" />

var value =  $('input[name=foo]').is(':checked') // to check whether its true or false 1st method
var value = $('input[name=foo]').attr('checked') // to check whether its true or false 2nd method
if(value ==true){
sshivannaAuthor Commented:
Thank you, the idea worked. I didn't realize that I can use a combo of javascript and jquery.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now