Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
-2
rated 0 times [  3] [ 5]  / answers: 1 / hits: 170170  / 13 Years ago, thu, august 18, 2011, 12:00:00

I have 3 Columns of ULs each a Dynamic UL container that can have anywhere from 0-9 LI containers (eventually more). All my LI elements have an attribute rel which I am trying to ultimately find that attribute and use it for something else on all LI elements within that parent DIV. I do eventually want to find more based on each but for not the very least the rel.. Any Ideas how I can achieve that with jQuery? Example:



<ul id=column1>
<li rel=1>Info</li>
<li rel=2>Info</li>
<li rel=3>Info</li>
</ul>
<ul id=column2>
<li rel=4>Info</li>
<li rel=5>Info</li>
<li rel=6>Info</li>
</ul>
<ul id=column3>
<li rel=7>Info</li>
<li rel=8>Info</li>
<li rel=9>Info</li>
</ul>


these elements are all sortable as well. So when I get a list of them I want to also keep them in the order they were found from top to bottom of each column.



I have tried find(), parent(), and similar, maybe I am approaching it wrong. But its still worth mentioning to help come up with an idea


More From » jquery

 Answers
46

Are you thinking about something like this?



$('ul li').each(function(i)
{
$(this).attr('rel'); // This is your rel value
});

[#90558] Tuesday, August 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
danyelletyanah

Total Points: 204
Total Questions: 109
Total Answers: 108

Location: Vanuatu
Member since Fri, Oct 22, 2021
3 Years ago
;