Category Archives: jQuery

Step by step from jQuery to Backbone

fstoerkle has a great step by step conversion I’ve seen many struggle when they first meet Backbone.js. In this blog post I will gradually refactor a bit of code from how I used to write JavaScript before, into proper Backbone.js code using models, collections, views and events. Hopefully this process will give you a firm [...]

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

Do you like grids?

gridster.js This is it, the mythical drag-and-drop multi-column grid has arrived. Gridster is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns. You can even dynamically add and remove elements from the grid. It is on par with sliced bread, or possibly better. It’s a cool plug in for drag [...]

Also posted in JavaScript, link, programming | Comments closed

JavaScript, what’s a $variable?

I was going through some JavaScript (jQuery) today with a colleague. We can across some code with a variable assignment like this: var $list = $(‘ul > li’); What does the $ sign do? Absolutely nothing. It’s perfectly valid to write a variable name with a $ anywhere within it. What does it mean then? [...]

Also posted in interesting, JavaScript, programming | Comments closed

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 .delegate(): [...]

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