jQuery fans blog and community sharing news, plugins, video tutorials, demos and more.

jQuery Get Index of Current Element

jQuery code snippet to get index of the current element. Good for those tasks that you use all the time and can simply put into a function for reuse. $.fn.getIndex = function(){       var $p=$(this).parent().children();     return $p.index(this); }

Continue reading →

jQuery Find Highest Z-Index on Page

jQuery code snippet find the highest z-index of absolute divs. Useful for making a new element appear absolutely at the top of all html elements. //include jQuery.js —  visit: http://jquery.com/ $(function(){     var maxZ = Math.max.apply(null,$.map($(’body > *’), function(e,n){          …

Continue reading →

jQuery Konami Code Listener

jQuery code snippet that listens for entry of a Japanese Konami code and then performs your desired action. if ( window.addEventListener ) {     var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";     window.addEventListener("keydown", function(e){         kkeys.push( e.keyCode );    …

Continue reading →

jQuery Set Default Input Values From Labels

jQuery code snippet to loop through a set of inputs and for each of them set the value to the associated label and then hide the label from view. $.fn.labelHide = function(){     return this.each(function(){         var current = $(this);  …

Continue reading →

jQuery Store Data in a Div

jQuery code snippet to store data in a div for reference later. The data is not shown in the div but is stored against the element. Note that if the jQuery collection references multiple elements, the value returned refers to the first element. Here is…

Continue reading →

Page 46 of 50 ←; First ... 44 45 46 47 48 ... Last →
scroll to top