Geeks With Blogs
Stuff I do my notepad

I want to put in this post some the jQuery methods that I found myself searching the web every other time i need them for the future reference.

Check if element exists:
if ($('#elementID').length > 0)
   // do somehting
Disable/enable element
$('#elementID').attr('disabled', 'disabled');
Clear DropdownList or ListBox
$('#ddl_ID >option').remove();
Add entry in the DropDownList or ListBox
Getting the text and value of the selected item in DropDownList
var selectedValue = $('#ddl_ID').val() or $('#ddl_ID option:selected').val() ;
var selectedText = $('#ddl_ID option:selected').text();
Check/uncheck checkbox:
$('#id]').attr('checked', true);
$('#id').attr('checked', false);
Check if checkbox is checked:
Check if element is disabled
Check if element is visible/hidden

There are a lot of resources available. I like Here is a nice topic - jQuery Tips and Tricks (

And there is one more to dig - jQuery HowTo (

more to come...

Technorati Tags: ,
Posted on Wednesday, December 16, 2009 8:28 PM jQuery , ASP.NET | Back to top

Comments on this post: My jQuery cheat sheet

# re: My jQuery cheat sheet
Requesting Gravatar...
Thanks for sharing! Good job!
Left by Catherine Russell on Feb 17, 2010 7:33 PM

# re: My jQuery cheat sheet
Requesting Gravatar...
:) You wellcome
Left by Vladimirl on Feb 17, 2010 8:09 PM

Your comment:
 (will show your gravatar)

Copyright © vladimirl | Powered by: | Join free