Some Useful JavaScript & jQuery Snippets
How to refresh the src of an image with jQuery? $(imageobj).attr('src', $(imageobj) .attr('src') + '?' + Math.random() ); How to see if an image is loaded or not with jquery var imgsrc =...
View ArticleSome Useful JavaScript & jQuery Snippets – Part 2
Check if cookies are enabled $(document).ready(function() { var dt = new Date(); dt.setSeconds(dt.getSeconds() + 60); document.cookie = "cookietest=1; expires=" + dt.toGMTString(); var cookiesEnabled...
View ArticleSome Useful JavaScript & jQuery Snippets – Part 3
How to hide all children div except a specific one with jQuery? $('#target div:not(#exclude)').hide(); //or $('#target').children().filter(':not(#exclude)').hide(); Detecting when a div’s height...
View ArticleSome Useful JavaScript & jQuery Snippets – Part 4
How to get client ip address with jQuery $.getJSON("http://jsonip.appspot.com?callback=?",function(data){ alert( "Your ip: " + data.ip); }); How to parse XML with jQuery file.xml: <?xml...
View Article