Hide isn't working in IE
Hide isn't working in IE
Hi,
This code works fine in Firefox, but in IE the fields don't "hide". I have a pull-down menu that is supposed to allow the user to hide or display two form fields. Any help is appreciated.
- <html>
- <head>
- <script type="text/javascript" src="jquery-1.4.2.js"></script>
- <script type="text/javascript" src="jquery.validate.js"></script> <!-- version 1.6 -->
- <script type="text/javascript">
- $(document).ready(function() {
- $("#hideornot").change(function(){
- var hideornot = $("#hideornot").val();
- if (hideornot == "Y") {
- $('#val2').hide('slow');
- $('#val3').hide('slow');
- } else {
- $('#val2').show('slow');
- $('#val3').show('slow');
- }
- });
- });
- </script>
- </head>
- <body>
- <form action="thanks.html" method="post" >
- <fieldset>
- <ul>
- <li><label for="hideornot">Hide or not?</label>
- <select name="hideornot" id="hideornot">
- <option value="Y" selected>Yes</option>
- <option value="N">No</option>
- </select>
- <div id="val2">
- <li><label for="val2">Val 2</label><input type="text" />
- </div>
- <div id="val3">
- <li><label for="val3">Val 3</label><input type="text" />
- </div>
- <li><input class="submit" id="submit" type="submit" value="Submit">
- </ul>
- </fieldset>
- </form>
- </body>
- </html>