mickey159
asked on
How to insert variable into jQuery gt() selector
Please help me to insert a variable to the gt function.
Example:
var something=1;
$("img:gt(something)").att r("somethi ng","somet hing");
Thanks
Example:
var something=1;
$("img:gt(something)").att
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>So I can just treat any selector like a string and use it with variables?
Yes?
var myString = ".aClassSelector";
$(myString).toggle();
>How can I use multi selectors with the selector mentioned above?
$("img:gt("+something+")", $(this))
Yes?
var myString = ".aClassSelector";
$(myString).toggle();
>How can I use multi selectors with the selector mentioned above?
$("img:gt("+something+")",
ASKER
Thanks and you are wonderful!
ASKER
Thanks
You're welcome! Thanks for the points!
ASKER
That's great news.
Also thanks for your code.
It works!!!
And one more question:
How can I use multi selectors with the selector mentioned above?
Something like $(this,"img:gt("+something
I tried this but it fails.
Thanks!