I am new to jquery so bear with me please :(
I have multiples button with css class name "one" on a page and each button is associated with another button with css class name "two".
"two" by default is set to display:none, and when "one" clicked, two is displayed. "two" will disappear when user click anywhere on the page.
I want when user clicked "one" the "two" that next to the "one" will be displayed instead of all "two" displayed.
I have the follow codes but don't know how to modify to fit my goal:
$(document).on("click", function (e) {
var clickedElement = $(e.target);
if (clickedElement.hasClass("one") ) {
//$(this).next().show(400, "linear"); <--my approach....but sadly didn't work
$(".two").show(400, "linear");
}
else {
$(".two").hide();
}
});
I made a demo in case if you want to see it :)