Link to home
Start Free TrialLog in
Avatar of darren-w-
darren-w-Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Find function skips duplicates

Hi,

I have a div like this:

 <div id="hintdata"><div class='10003137'>Key Skills Level 3</div><div class='10003162'>Key Skills Level 3</div><div class='10003198'>Key Skills Level 3</div><div class='10030463'>Hairdressing</div><div class='10030475'>Hairdressing</div><div class='10038310'>Key Skills Level 3</div><div class='10038358'>Key Skills Level 3</div><div class='10038395'>Key Skills Level 3</div><div class='10058722'>Food level 2</div><div class='10064588'>Additional Maths</div><div class='10064588'>Additional Maths test100510</div><div class='50018048'>Welsh bacc Level 3</div><div class='50018073'>Art and Design</div><div class='50018097'>Art and Design</div><div class='50018103'>Art and Design</div><div class='50020481'>Food level 2</div><div class='50036725'>Travel and Tourism Year 12</div><div class='50036725'>Travel and Tourism Year 13</div><div class='50042555'>History of Art</div><div class='50067540'>Food Level 1</div></div></div>

Open in new window


and when I run this in firebug: $('#hintdata').find('div').each(function(index,element){
console.log($(element).text());
})

it does not return the div's with the same number.:

[div.10003137, div.10003162, div.10003198, div.10030463, div.10030475, div.10038310, div.10038358, div.10038395, div.10058722, div.50018048, div.50018073, div.50018097, div.50018103, div.50020481, div.50042555, div.50067540]

Open in new window



I would like to aggregate each div so that for example :

<div class='10064588'>Additional Maths</div> <div class='10064588'>Additional Maths test100510</div>

is edited to:
[code]
<div class='10064588'>Additional Maths<br />Additional Maths test100510</div> 

Open in new window

How would this be done?

Darren
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of darren-w-

ASKER

That worked great, thanks Darren
You're welcome! Thanks for the points!