javascript - By default show first container -


hello friends found show hide div script on fiddle, script need use in project problem want show first container text default default shows nothing show on button click. 1 can me this, w'll b full.

<div class="btn-group" data-toggle="buttons-radio">      <button id="btn-game" data-target="game_container" class="btn btn btn-primary" type="button">game</button>     <button id="btn-video" data-target="video_container" class="btn btn btn-primary" type="button">video</button>     <button id="btn-giveaway" data-target="giveaway_container" class="btn btn btn-primary" type="button">giveaway</button> </div> <div class="see se" id="game_container">     game stuff </div>  <div class="see" id="video_container">     video stuff </div>  <div class="see" id="giveaway_container">     giveaway stuff </div>  $(document).ready(function() {     $('.see').hide();     $('.btn-group button').click(function(){         var target = "#" + $(this).data("target");         $(".see").not(target).hide();         $(target).show();     }); }); 

fiddle demo

you can hide container excluding first below. hope helps.

$('.see').not(':first').hide(); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -