javascript - sorting is not performing in jquery -


i doing sorting on div, unable perform sorting. using jquery.fn.sortelements. below html.

<div id="sortlist">     <div class="list" style="display: block;">         <a onclick="openinfowindow("10"); return false;" href="#"></a>         <div class="imgclass">             <a onclick="openinfowindow("10"); return false;" href="#">             <img class="innerimg" alt="" src="img">             </a>         </div>           <div class="inner">             <div class="name">edata</div>            </div>     </div>      <div class="list" style="display: block;">         <a onclick="openinfowindow("10"); return false;" href="#"></a>           <div class="imgclass">             <a onclick="openinfowindow("10"); return false;" href="#">             <img class="innerimg" alt="" src="img">             </a>         </div>           <div class="inner">             <div class="name">fdata</div>            </div>     </div>      <div class="list" style="display: block;">         <a onclick="openinfowindow("10"); return false;" href="#"></a>           <div class="imgclass">             <a onclick="openinfowindow("10"); return false;" href="#">             <img class="innerimg" alt="" src="img">             </a>         </div>           <div class="inner">             <div class="name">cdata</div>            </div>     </div> </div> 

below jquery code, have placed alert see result nothing happens.

$('.sortlist').sortelements(function(a, b){                 alert($(a).find(".list").children(".inner").find(".name").text().tolowercase())                                      return $(a).find(".list").children(".inner").find(".name").text().tolowercase() > $(a).find(".list").children(".inner").find(".name").text().tolowercase() ? 1 : -1;                 }); 

any appreciated

try this:

$('#sortlist .list').sortelements(function(a, b){        return $(a).children(".inner").find(".name").text().tolowercase() > $(b).children(".inner").find(".name").text().tolowercase() ? 1 : -1; }); 

see fiddle


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -