Why Not?

What shall we do today…

Tag: jQuery

Making Usable Frameworks and SDKs

User experience is one of the most important parts when developing a project. Users should never have to think or fight with your product if you wish for it to succeed. If you look at most of the successful web applications today, the simplicity of the user experience if prevalent.  Gmail and Google Calendar are [...]

Presentation Tonight on Javascript and jQuery

Tonight I will be doing a presentation for VT’s ACM Students Teaching Students Series. It is titled: Doing More with Less: Javascript and jQuery I will be going over the basics of the javascript language and the jQuery framework.  It should be a great time with some free pizza and soda as well! If you [...]

jQuery: Remove All List Elements but First One

Here is a quick jQuery snippet to remove all DOM elements from a list except for the first one: $(“li:not(:first)”).remove(); Where would this be useful? Say you are adding user choices to a list for a query and you have a remove event attached to each item. But you want the user to be able [...]

Making jQuery calls in a function when a parameter can be a string or integer

Consider a function of when you are creating a list of items that have unique IDs, some are long integers and some are strings since they are a mix of chars and integers.  Also, you have very little control over these id values since they are retrieved from a web service and are too long [...]

Chaining in jQuery

I just finished watching a great presentation by John Resig, creator of jQuery, on javascript and jQuery (redundant, i know). One interesting point he made about the library was the idea of chaining in jQuery and how it creates its own stack. Given the following code: $(“ul”).find(“li”).hide().end().find(“div”).load( “somePage.html” ).end(); Can translate into this: $(“ul”) //returns [...]

How to Submit Javascript Arrays through jQuery AJAX calls

When making ajax calls in jQuery there are 4 simple functions one can use to access data on the server: $.ajax $.get $.post $(‘#blah’).load Now there is ample documentation about how to use these functions, but I have not seen any that deals with submiting data to the server from an array of values, which [...]

Retrieving the pixel location of a DOM element

jQuery is an awesome javascript library that GREATLY simplifies iterating through various elements in the DOM, retrieving various attributes of elements, and makes the amount of code you write smaller. In this post I am going to explain a snippet of code that will grab the x and y pixel coordinates of any element in [...]