0

I have an HTML page which shows the data in in list form. It uses Tree hierarchy to load the data which comes up in the form of

<ul>
  <li>A
    <ul>
      <li>subsection</li>
    </ul>
  </li>
  <li>B
    <ul>
      <li>subsection</li>
    </ul>
  </li>

I'm using this to fetch the data from json file.

<li data-bind="attr: {id: $data['id']"> <div class="container"> <strong><span data-bind="text: $data['name']" class="oj-navigationlist-item-title speech"></span></strong></div></li>

Now I want to add a image icon only to the parent and not to the child dynamically.

jcubic
  • 61,973
  • 54
  • 229
  • 402
  • How to add the image icon on parent
  • only
  • – user3780690 May 27 '16 at 13:39
  • @user3780690 should probably include fact you're using `Knockout.js` in question, and how you're using it to create the list. Seems significant. – Don Cheadle May 27 '16 at 13:44
  • http://stackoverflow.com/questions/10659665/knockout-template-using-data-bind-to-image-src-property-not-working may help – Don Cheadle May 27 '16 at 13:48
  • I;m looking for something similar to this http://stackoverflow.com/questions/4830624/target-first-level-lis-and-not-the-nested-lis – user3780690 May 27 '16 at 14:01
  • The only difference is that my parent and child
  • are coming dynamically. Hence I dont understand how to restrict image icon to only appear on parent
  • – user3780690 May 27 '16 at 14:02