javascript - add image src and <a> href in List.js -


i using plugin list.js. working fine. don't know how add image src or href values in it. works fine , other tags.

here url list.js. http://listjs.com/

and here documentation. https://github.com/javve/list

here code.

<script src="http://code.jquery.com/jquery-1.9.0.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 

<div id="div1">     <input class="search" id="text1" />     <span class="sort" data-sort="name">sort name</span>     <span class="sort" data-sort="desc">sort desc</span>     <ul class="list">     </ul> </div>  <div style="display: none;">      <div id="hacker-item1">          <div style="width: 20%; float: left">             <table>                 <tr>                     <td colspan="2" align="center" valign="top">                          <a href="">                              <img alt="" width="125" height="125" border="0" class="name">                                </img>                         </a>                     </td>                 </tr>                 <tr>                     <td align="center" valign="top" class="desc">                          <br></br>                      </td>                     <td class="createddate"></td>                 </tr>             </table>         </div>          <h3 class="name"></h3>         <p class="desc"></p>         <p class="createddate"></p>     </div> </div> <script src="list.js"></script>  <script type="text/javascript">      var options = {         item: 'hacker-item1'     };      var values = [ { name: 'jonny', desc: 'stockholm', createddate: 'june 8, 2013' } , { name: 'jonny', desc: 'stockholm', createddate: 'may 8, 2013' } , { name: 'sssssss', desc: 'eeeeeeeee', createddate: 'june 20, 2013' }     ];     //    values.push({name : xml.getelementsbytagname("title")[0].childnodes[0].nodevalue, desc : xml.getelementsbytagname("title")[0].childnodes[0].nodevalue,createddate : xml.getelementsbytagname("publishdate")[0].childnodes[0].nodevalue});     var hackerlist = new list('div1', options, values);     //alert(hackerlist.items.length + '--');  </script> 

i'm afraid looks plugin can't used in way.

the plugin wraps value provide (in values) tag class matches array element's key (e.g. passing name : jonny inserts 'jonny' inside tag class of 'name'). can't tag attributes (like href or src), they're in different scope plugin operating.

you wrap values in a tag, that's not you're trying here.

i think you'll need either extend plugin support this, or write own code execute after plugin rewrite generated markup.


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -