Category Archives: jQuery

Iterate through objects properties with jQuery

Tim Büthe $.each( { name: “John”, lang: “JS” }, function(i, n){ alert( “Name: ” + i + “, Value: ” + n ); }); I didn’t realise that you could treat an object just like an array with $.each(). The $.each() function is not the same as $(selector).each(), which is used to iterate, exclusively, over [...]

Also posted in interesting, programming | Comments closed

Increasing Event Binding Performance using Jquery Delegate

An easy performance improvement from Schotime Instead of creating 50 events, one for each row, I’m binding the event to the surrounding table element and then using the fact that the events bubble up through parent elements to catch the appropriate event. The .delegate() method: $("table").delegate("td", "click", function() { $(this).toggleClass("chosen"); }); Please note that for [...]

Also posted in link, programming | Comments closed

Knockout JS talk by Steve Sanderson

This looks like a very cool library. I do like the concept of using a Model View ViewModel pattern; especially after using it a lot in ASP .NET MVC3. A view model is a useful abstraction from your model as you can present data to the view in a way the view wants and only [...]

Also posted in link, programming | Tagged , | Comments closed

Stamp pad in backbone.js

Recently I’ve been looking at JavaScript frameworks. This is in an effort to reduce how unwieldy the web applications I deal with at work get. One of the first I found is Backbone.js. From my initial foray into it; it’s fairly loose and there are some knowledge gaps that aren’t documented. The issue I’ve found [...]

Also posted in programming | Tagged , | Comments closed

HTML5 localstorage – Simple notepad

I wanted to create a simple timestamped notepad using just HTML and JavaScript. This meant I wanted to store some data locally, at least in the browser. So I started looking at HTML5′s localstorage. In order to get started I hit up Google and came across this blog post on localstorage. Definitely visit there if [...]

Also posted in programming | Tagged , | Comments closed

jQuery .ajax and jsonp

I was recently trying to use a jQuery.ajax request with JSONP as my data type. The URL I was trying to hit didn’t exist. Instead of hitting the error function, it was ignored completely! After some digging around I found the issue: error(jqXHR, textStatus, errorThrown) Note: This handler is not called for cross-domain script and [...]

Posted in jQuery | Tagged | Comments closed

jquery.hotkeys – secondary action experimentation

From jeresig, jquery.hotkeys jQuery Hotkeys is a plug-in that lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination. I’ve been having a little play around with this and it seems pretty cool. It was missing a secondary action though. E.g. You push ctrl + a [...]

Posted in jQuery | Tagged , | Comments closed

Page optimized by WP Minify WordPress Plugin