$("a[rel=example_1],a[rel=example_2],a[rel=example_3],a[rel=example_4],a[rel=example_5],a[rel=example_6],a[rel=example_7],a[rel=example_8],a[rel=example_9],a[rel=example_10]").fancybox({............
Hello, right now I have to manually enter those codes.
Is there an easy way to increment the numbers?
I know I can use something similar to a[rel=example_[1-10]]. What is the correct syntax?
many thanks
One potential solution would be to use a loop.
Alternatively, if you wanted to match all elements with a
relcontaining “example_”, you can use an attribute selector like this:Finally, you could simply use a class to link all of the elements and select them by referencing the common class.