Archive for the ‘Patterns’ Category
Checking all your checkboxes with jQuery
Ok I know this blog is geared towards ExtJS and I do expect you to lambast me for posting jQuery code snippets but, in my free time one lunch time I decided what it would be like to rewrite the ExtJS vertical checkbox examples I’ve been posting using jQuery.
Turns out, there’s not a great deal of difference in the length of the code, maybe the clarity and readability is slightly improved with jQuery, although looking at it there’s not a great deal in it. So for shits n giggles here’s my jQuery code:
<script type="text/javascript">
$(document).ready(function(){
$("#select_none").click(function(){
$(":checkbox").attr("checked", false);
$("#update_button").attr("disabled", true);
return false;
});
$("#select_all").click(function(){
$(":checkbox").attr("checked", true);
$("#update_button").attr("disabled", false);
return false;
});
// clear all checkboxes.
$("#select_none").click();
$(":checkbox").click(function(){
if($(this).attr("checked") == true)
{
if($("#update_button").attr("disabled")==true)
$("#update_button").attr("disabled", false);
}
else
{
if($(":checked").length == 0)
{
$("#update_button").attr("disabled", true);
}
}
})
});
FYI if you’re interested in checking out jQuery in more detail, have a look at the post over on Ajaxian filled with jQuery videos presented by John Resig himself.
Aptana error missing plugin org.eclipse.ui
If you get the
Aptana requires missing plugin org.eclipse.ui
It got it when trying to install the Adobe AIR extensions.
Simply navigate to your installation directory of Aptana and run
AptanaStudio.exe -clean
Which cleans the cache so I’m told.
see here
Javascript Singleton Pattern explained
Hi Folks,
Here’s a great site with an explanation of the Singleton design pattern in Javascript with examples.