Hey folks.
Show and hide only works on the first <div>.
Any suggestions on how it can work on multiple <div>
Show and hide only works on the first <div>.
Any suggestions on how it can work on multiple <div>
JavaScript:
<script type="text/javascript">
$(function(){
$("#settings").hide();
$("#show_hide").click(function(){
if($("#settings").hasClass("hide")){
$(this).text("[-]");
$("#settings").removeClass("hide");
$("#settings").addClass("show");
$("#settings").show();
}else{
$(this).text("[+]");
$("#settings").removeClass("show");
$("#settings").addClass("hide");
$("#settings").hide();
}
});
});
</script>
HTML:
<div class="info">
<span id="show_hide">[+]</span> <h4>text 1</h4>
</div>
<div id="settings" class="hide">
<div class="row">bla bla bla</div>
</div>
<div class="info">
<span id="show_hide">[+]</span> <h4>text 2</h4>
</div>
<div id="settings" class="hide">
<div class="row">bla bla bla</div>
</div>