i got a problem with the map function, maybe i got it wrong.
i have a menu that consists of div layers (here is one item)
<div class='menu_item inner_node' hash='4' depth='0'>Portfolio</div>
if some one click it the css class selected is added to that item.
now i want to get all selected menu items with map() like this:
$("div.selected").map(function()
{
return $(this).attr("hash");
}
).get().join(", ");
i just need the “hash” attribute from it.
i made an example here: Example
the output is undefined everytime…
what is wrong with the script?
regards,
peter
You’re missing a
returnin functionget_hash().http://jsfiddle.net/gruhH/1/