Javascript examples for jQuery Selector:id
Count Upwards for ID jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript"> $(window).load(function(){/* w ww .ja v a 2 s . c om*/ $("div[id^=test-]").each(function(){ $that = $(this) $that.text("divID = " + $that.attr("id").split("-")[1]) }) }); </script> </head> <body> <div id="test-1-yay"></div> <div id="test-2-yay"></div> <div id="test-3-yay"></div> </body> </html>