1

I have the following code to hide an essay question or open text.
I'd like to have the same effect but hide a drop down box.

In this example below if you select the "I will write in my choice below" the essay question will auto remove. I need to change this essay question to a drop down and I need the supporting Jquery to make the drop down dissaper if the write in choice is selected.

Please select your First Choice from the drop down or tell us that you will "Write In" or choice by selecting "I will "Write In" my choice below.
__________________________________
__________________________________
__________________________________

Q. I will "Write In" my choice below.

jQuery(function($){
   $('input[type=checkbox]',$('#table1')).click(function(){
     if($(this).is(':checked')){
        $('textarea',$('#table1')).empty().hide();
     } else {$('textarea',$('#table1')).show();}
   });
});

Thank you!

7
  • 1
    no, it is for my job - I am not in IT. I am just trying to learn Jquery in 30 minutes or less Commented Feb 21, 2012 at 19:15
  • 2
    Mary, it would be really useful for us to see a HTML in an example. I'm a bit confused by your question. Here you can build your demo: jsbin.com or here: jsfiddle.net BTW, you can hide an element doing: $('select#dropdown').hide(); Commented Feb 21, 2012 at 19:17
  • do you have a way I could show you privately? Commented Feb 21, 2012 at 19:23
  • This is for an "employee survey" if you will. I have the survey built and can give you a link but I would prefer to send it to you via e-mail. Commented Feb 21, 2012 at 19:24
  • 1
    @MaryPlissey To get help on Stack Overflow, details need to be contained within your question. Commented Feb 21, 2012 at 19:34

1 Answer 1

1

jsBin demo

HTML

  <p>Please select your First Choice from the drop down or tell us that you will "Write In" or choice by selecting "I will "Write In" my choice below.</p>
   
  <select id="choose_question">
    <option selected="selected">Choose a question</option>
    <option value="q1">Question 1</option>
    <option value="q2">Question 2</option>
    <option value="q3">Question 3</option>
    <option value="q4">Question 4</option>    
  </select>
  
  <br>
  
  <input id="ill_write" type="checkbox" /> I will write in my question.
  
  <br>
  
  <input id="my_question" type="text" value="" style="display:none; width:300px;"/>

jQuery

$('#choose_question').change(function(){  
  $('#my_question').fadeTo(50,0);
  $('input#ill_write').prop('checked', false);
});

$('#ill_write').change(function(){  
  $('#my_question').fadeTo(500,1); 
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.