-3
<div class="checkbox"><input value="Yes" name="beta_interest" class="checkbox-input" id="beta_interest" type="checkbox"> <label for="beta_interest" class="checkbox-label icon-checkmark">Are you interested in joining program?</label></div> <div class="checkbox"><input value="Yes" name="opt_in" class="checkbox-input" id="opt_in" type="checkbox"> <label for="opt_in" class="checkbox-label icon-checkmark">Yes, I’m interested in receiving announcements</label></div> 

I need to hide or show the second div based on some dropdown condition. How do I hide or show?

1

3 Answers 3

0

This question is horribly worded, but you're answer is to use the .hide() extension. Just use $('elementIdentifier').hide();

Sign up to request clarification or add additional context in comments.

4 Comments

This does not seem to work
@user3276594 do you have JQuery added?
Yes i have added the jquery libarary and it loads fine.I need to hide the div of the input element which has id="opt_in"
Then use an id identifier for opt_in ($('#opt_in').hide();)
0

Add this to the style property of the div:

style=display:none;

and to show the div:

style=display:inline;

Comments

0

Use change function on dropdown and then hide your div according to condition.

$(document).ready(function() { $('#divChanger').change(function() { var value = $("#divChanger").val(); if (value == 1) { $("#first").hide(); } if (value == 2) { $("#second").hide(); } }) })
<select id="divChanger"> <option vlaue="">Select here</option> <option value="1">1</option> <option value="2">2</option> </select> <div id="first"> <h1> I am First Div </h1> </div> <div id="second"> <h1> I am second div </h1> </div> </div> </div>

Here's the fiddle for example.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.