jQuery - search for previous selector relative to current -
There is a form with 3 squares in it
My question is if I A tip class is a "hat-tip" to give help to "form-tip" and a square of each input, how can I always look at the last "form-tip" div?
Something like this:
$ ('is-tip') each (focus (function () {var tip = $ (this) .attr ('title' ); // Find the most recent $ ('. Form-tip') fill it with the dome and tip}});
I hope that makes sense .. Thanks for any help.
if .has-tip
If you have a child's .form-tip
you can use it like this:
$ ('.has-tip') each (focus (function () {Var tip = $ (this) .attr ('title'); var ft = $ (this) .closest ('form-tip'); / / Most recent $ in DOM ('. Find and reply it with a tip}});
If it is a brother, you can use it or if it immediately is not before, so it is.
Comments
Post a Comment