Posts

How to disable/enable an element with jQuery

Sometimes you need to disable or enable some elements in your document and jQuery makes this task easy. All you have to do is to set disabled attribute to "disabled". Example: // To disable $('.someElement').attr('disabled', 'disabled'); In order to enable any disabled element you need to set the disabled attribute to empty string or remove it entirely like in the code below. // To enable

How to disable/enable an element with jQuery

Sometimes you need to disable or enable some elements in your document and jQuery makes this task easy. All you have to do is to set disabled attribute to "disabled". Example: // To disable $('.someElement').attr('disabled', 'disabled'); In order to enable any disabled element you need to set the disabled attribute to empty string or remove it entirely like in the code below. // To enable

Caching in jQuery

What is great about jQuery is its simplicity in selecting elements. We all use it here and there, basically everywhere. This simplicity comes with its drawbacks. jQuery traverses through all elements every time we use selectors. So to boost up your jQuery application you should always cache your selections to some variable (if you find yourself using the same selection more than once). In case

Caching in jQuery

What is great about jQuery is its simplicity in selecting elements. We all use it here and there, basically everywhere. This simplicity comes with its drawbacks. jQuery traverses through all elements every time we use selectors. So to boost up your jQuery application you should always cache your selections to some variable (if you find yourself using the same selection more than once). In case

How to check if checkbox is checked using jQuery

Note: If you are new to jQuery, you might find our short jQuery beginner tutorials useful. While working on my previous project I needed a way to check if the certain checkbox is checked or not. jQuery is a great library but I had a hard time identifying if any particular checkbox was checked. So here is the way to do just that. All you need to do is to check checked attribute of checkbox HTML

How to check if checkbox is checked using jQuery

Note: If you are new to jQuery, you might find our short jQuery beginner tutorials useful. While working on my previous project I needed a way to check if the certain checkbox is checked or not. jQuery is a great library but I had a hard time identifying if any particular checkbox was checked. So here is the way to do just that. All you need to do is to check checked attribute of checkbox HTML

How to test JavaScript code performance

Sometimes after all day long coding your code becomes not so effective and your code (usually interface related) becomes slow. You have done so many changes and don't exactly know what slowing it down. In cases like this (and of course, plenty other cases) you can test your JavaScript code performance.  First of all, you need Firefox browser and Firebug web developers life saver plugin. I can not