jquery - This JavaScript doesn't work in Opera -


i use function in website. http://jsfiddle.net/alkasih/kn2695r7/

it works fine in mozila, in opera, doesn't seem work. can me how make works in browser. because may big deal website.

var currentdiv = 0;  $(document).ready(function(){    $("#pilihwarna option").click(function(){      $(".bigandsmall").eq($(this).index()).css( "display", "block" );        if($(this).index()!=currentdiv){        $(".bigandsmall").eq(currentdiv).css("display","none");}      currentdiv=$(this).index();      })  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <select id="pilihwarna" name="fgdfd" style="background:none;">    <option>satu</option>    <option>dua</option>    <option>tiga</option>    <option>empat</option>  </select>        <div class="something">    <div class="bigandsmall">      <p>satu</p><img src="image/chrysanthemum.jpg" width="50px" /></div>      <div class="bigandsmall">      <p>dua</p><img src="image/desert.jpg"  width="50px"/></div>      <div class="bigandsmall">      <p>tiga</p><img src="image/hydrangeas.jpg"  width="50px"/></div>      <div class="bigandsmall">      <p>empat</p><img src="image/jellyfish.jpg"  width="50px"/></div>  </div>

i guessing want this.

$("#pilihwarna").change(function () {     $(".bigandsmall").hide().eq($("#pilihwarna")[0].selectedindex).show(); }); 

use change, useful when user navigates keyboard anyway. , use selectedindex index of selected option.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -