html - Jquery targeting a parent div not working -
I have a button, when clicked, I want to physically make another section called 'hidden' has given. I do not think I'm doing my job right on markup.
Here's my jQuery
$ (document) .ready (function () {$ ('click (function () {$ (this) .find (' ('' Tick ''). FeidIn (500); $ (this). Parent ('pt-trigger-container'). ('Hidden'). FadeIn (500);});}); < / pre> I have also created one.
You need to use .parents () not .parent () $ (document) .ready (function () {$ ('. singleBtn'). Click (Function () {$ (this). Find ('.tick'). Feedin (500); $ (this) .Parents ('.pt-trigger-container'). ('Hidden'). FadeIn (500);});}); Or come You can also use the .closest () : $ (document) .ready (function () {$ ('. Single BTN') Function () {$ (this) .find ('.tick'). Feedin (500); $ (this) .closest ('pt-trigger-container'). ('.hidden'). FadeIn (500); }};});
Try it out:
$ (document) .ready (function () {$ ('. SingleBtn '). Click (function () {$ (this) .phid ('.tick'). Fadein (500); $ (this) .clostest ('pt-trigger-container'). Next (). FadeIn (500); });});
Comments
Post a Comment