jquery - Toggle divs and add class active to them -
i have example here there random divs , when button linked them clicked, want tooltip toggle 9hide/show) can do- here problems:
1) when click onto button other tooltip doesnt hide getting toggle on , off not toggling off when click on button.
2)previously, when had 1 toggling, toggle class updated code not case , seems ignore it.
3) example have there way instead of having:
<input type="button" id="" class="buttons" value="tooltip1"></input>
to have div stuck pull value bit in jquery divs dont have value state on form elements?
var div= $("#"+this.value);
sorry if seems bit silly, new jquery , learning go along. guidance grateful.
try jquery code :
$(".buttons").click(function () { tooltip = "#"+$(this).val(); $('.tooltip').not(tooltip).hide() if ($(tooltip).is(":visible")) { $(tooltip).hide().removeclass("selected") } else { $(tooltip).show().addclass("selected") } });
and have jsfiddle.
Comments
Post a Comment