can we add a value of attr src Instead of the value of attr class in the list of values in list.js?

60 Views Asked by At

this is my code html:

   <html>
        <head>
        </head>
        <body>
          <input class="search" placeholder="Search"  />

          <div id="users">

           <ul class="list">

          </div>
          <script  src="jquery-1.10.1.min.js" ></script>
          <script src="list.min.js"></script>
          <script src="code.js"></script>
   </body>
</html> 

and this is my code js:

var test = [{name:"Joo",born:1986,source:"impat.png"},
            {name:"Jonas",born:1888,source:"impat.png"}];

   var options = {
            item: "<li><img src='source'/><h3 class='name'></h3><p class='born'></p></li>"
        }

   var listObj = new List('users', options,test);

I know it doesn't work but I hope someone offers me a good solution

1

There are 1 best solutions below

0
On

Change your options to class like so and it will input the src:

var options = {
    item: "<li><img class='source'/><h3 class='name'></h3><p class='born'></p></li>"
}