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

JavaScript Snippet Force a DOM Element Redraw/Repaint

JavaScript code snippet to force a DOM element redraw/repaint. A bit hacky but useful as a last resort. var element = document.getElementById(’id’); var n = document.createTextNode(’ ‘); var disp = element.style.display;  // don’t worry about previous display style element.appendChild(n); element.style.display = ‘none’; setTimeout(function(){    …

Continue reading →

JavaScript Double Negation (!!) Trick or Trouble?

So I was being asked to include some double negation comparison operators in my JavaScript Shorthands Techniques post and decided to have a closer look at whether or not we could be using it more often in our code. See speed tests below. !! is…

Continue reading →

Different ways to run a JavaScript function

I was looking back at some work and thought it would be good to do a post about different ways to load JavaScript functions (notably foo()) from inside HTML elements. Take a look below at some examples. 1 – anchor naked Mouse cursor may not…

Continue reading →

What is javascript:void(0);

What is javascript:void(0);? This operator allows inserting expressions that produce side effects into places where an expression that evaluates to undefined is desired. The void operator evaluates the given expression and then returns undefined. Example Usage <a href="javascript:void(0);">Click here to do nothing</a> <a href="javascript:void(document.body.style.backgroundColor=’green’);">Click here…

Continue reading →

What is the jqXHR object?

The jQuery.ajax() function is basically just one big jqXHR object (essentially a fake javaScript xhr object). The jqXHR (jQuery XMLHttpRequest) replaces the browser native XMLHttpRequest object. jQuery wraps the browser native XMLHttpRequest object with a superset API. The jQuery XMLHttpRequest (jqXHR) object is returned by…

Continue reading →

Page 1 of 16 1 2 3 4 5 ... Last →
scroll to top