-1

OK, I basically have the following scenario with some dynamically generated html:

<div id = "main-hold">
    <ul class="main-class">
        <li class="item">
        <a tabindex="-50" title="Title 1" class="class aa" id="12365" href="#" target="">Learning outcomes<div class="end-icon"></div></a>

...

Basically I want to be able to show/hide objects of class "item" using the unique id referenced within, but am struggling to target it. Any thoughts appreciated

$("#main-hold").hide();

Successfully hides everything, but I haven't been able to drill down to the id level.

  • Is it the `li` elements you want to hide or `a` elements in them? If `li`s do they all have the class `item`? – PeterKA Mar 23 '15 at 15:06
  • Hi, Yes, they are all of class item, so I thought the unique id would be the best option to target individuals. To hide the a elements in them would be sufficient. – BungalowHead Mar 23 '15 at 15:13
  • What unique ID are you referring to? In response to **WHAT** event would you like to hide/show individual `li.item` elements? You may probably have to give us more code than you have given us ... Give us some context. – PeterKA Mar 23 '15 at 15:16
  • Sorry, so from the snippet above, if you can imagining it continuing on like
  • ...
  • with many items, the a element of each of which will be identical to the one above but with just different content. The id="12365" in the one above will be unique to each "item" so I thought that targeting this would be an easy way to show/hide specific items. And sorry, it is in response to buttons clicks that I would like to show hide these specific items, the clicks of which I can currently successfully capture.
  • – BungalowHead Mar 23 '15 at 15:17