var a = $('a[class^=ad-thumb'), id = a[ a.index($("a.ad-active"))+1 ].id;
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> $(function(){ var a = $('a[class^=ad-thumb]'), id = a[ a.index($("a.ad-active"))+1 ].id; alert(id); }); </script> <div class="ad-thumbs"> <ul class="ad-thumb-list" style="width: 1520px;"> <li> <a href="" value="15" id="15" class="ad-thumb15 ad-active"> <span class="thumb"><i></i> <img nctype="thumb" title="" start_id="15" src="" style="opacity: 1;"> <input type="hidden" value=""></span> </a> </li> <li> <a href="" value="14" id="14" class="ad-thumb14"> <span class="thumb"><i></i> <img nctype="thumb" title="f02" start_id="14" src="" style="opacity: 0.7;"> <input type="hidden" value=""></span> </a> </li> </ul> </div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> $(function(){ var a = $('a[class^=ad-thumb'), id = a[ a.index($("a.ad-active"))+1 ].id; alert(id); }); </script> <div class="ad-thumbs"> <ul class="ad-thumb-list" style="width: 1520px;"> <li> <a href="" value="15" id="15" class="ad-thumb15"> <span class="thumb"><i></i> <img nctype="thumb" title="" start_id="15" src="" style="opacity: 1;"> <input type="hidden" value=""></span> </a> </li> <li> <a href="" value="14" id="14" class="ad-thumb14 ad-active"> <span class="thumb"><i></i> <img nctype="thumb" title="f02" start_id="14" src="" style="opacity: 0.7;"> <input type="hidden" value=""></span> </a> </li> </ul> </div>
var a = $('a[class^=ad-thumb]'), n = a.index($("a.ad-active")), id; n = (n == a.length-1) ? 0 : n+1; id = a[n].id;