0

On ie8 this doesn't work. Meaning I don't see bobo and dodo when I click on the dropdown choice. I DO see bobo and dodo in ie9. I actually have simplified the code for what I originally had, which has five divs and shows/hides different ones based on the dropdown choice.

It also works in ff22 and chrome latest.

Do you have a suggestion for me?

{<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<script src="jquery-1.10.1.js">     
</script>
<script type="text/javascript">
        $(document).ready(function(e) {
            $('#situation').on('change', function() {
                if($(this).val() === 'all') {
                    $('.products').hide();
                    $('.accountname').hide();                 
                } 
                else if  ($(this).val() === 'newcase'){
                    $('.products').show();
                    $('.accountname').show();
                }
         });
    });
</script>
<body>
    <form method="POST" action='RuleController' name="frmAddRule">  
    <select type="text" name="situation" size="1" id="situation">
    <option value="all">Choose event . . . </option> 
    <option value="newcase" >New Case Has Been Created</option> 
    </select> 

    <div class="products" style=" display: none;">
    bobo
    </div>

    <div class="accountname" style=" display: none;">
    dodo
    </div>
    </form>
</body>
</html>}
Koterpillar
  • 7,883
  • 2
  • 25
  • 41

1 Answers1

0

Use double equal sign.

More info on SO : Difference between == and === in JavaScript

$(document).ready(function(e) { 
    $('#situation').on('change', function() {
        if($(this).val() == 'all') {
            $('.products').hide();
            $('.accountname').hide();                 
        } 
        if($(this).val() == 'newcase'){
            $('.products').show();
            $('.accountname').show();
        }
    });
});
Community
  • 1
  • 1
yeyene
  • 7,297
  • 1
  • 21
  • 29