RcBuilder@walla.com
call centre: 054-5614020

jQuery Counters – count page elements

Posted by: RcBuilder  /   Category: a / body / children / div / each / HTML / JAVASCRIPT / jQuery / not / size / span / tagName   /   No Comments
20
Oct
2014

jQuery Counters - count page elements html <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="jquery-1.5.2.min.js"></script> </head> <body> <a limited="1">LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a>LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a limited="1">LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a>LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a limited="1">LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a limited="0">LINK</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a limited="1">LINK</a> <br /><br /> <span>SPAN</span>&nbsp;&nbsp;|&nbsp;&nbsp; <span limited="1">SPAN</span>&nbsp;&nbsp;|&nbsp;&nbsp; <span limited="1">SPAN</span>&nbsp;&nbsp;|&nbsp;&nbsp; <span>SPAN</span> </body> </html> counters // 14 (all elements within the body element) alert($('body').children('*').size()); // 18 (all tags including head, script etc.) alert($('*').size()); // 7 (all non link elements within the body element) alert($('body').children('*').not('a').size()); using $('body').children('*').each(function () { alert(this.tagName);.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים