javascript - Issue in opening two dropdown at same time -


here id dropdown fiddle http://jsfiddle.net/ym8t7lhj/

the issue facing having 2 dropdowns, if click on 1 dropdown dropdown opening. can 1 me out in this.

script

        $(document).ready(function() {         $(".dropdown dt a").click(function() {         $(this).toggleclass("myclass");           $(".dropdown dd ul").toggle();          });          $(".dropdown dd ul li a").click(function() {              var text = $(this).html();             $('.dropdown dt a').toggleclass('myclass');             $(".dropdown dt span").html(text);             $(".dropdown dd ul").hide();             $("#result").html("selected value is: " + getselectedvalue("sample"));         });           }); 

try this

$(document).ready(function() {  $(".dropdown dt a").click(function() {         $(this).toggleclass("myclass");           $(this).closest('dl').find('ul').toggle();  });   $(".dropdown dd ul li a").click(function() {              var text = $(this).html();              $(this).closest('dl').find('dt a').toggleclass('myclass').find('span').html(text);              $(this).closest('ul').hide();             $("#result").html("selected value is: " + getselectedvalue("sample"));   });       }); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -