All jQuery Code Examples

Get Radio Button value using jQuery

Here’s small piece of code to get the value of a checked or selected radio button out of a group of radio buttons. var selValue = $('input[name=rbnNumber]:checked').val(); In above code, rbnNumber is name of the radio group. Demo HTML Code: jQuery Code: Result: See Complete Code You can also get the value of individual radio […]
Read the rest of this entry »

How to check element visible or hidden using jQuery

Below is a simple piece of jQuery code which checks the visibility of element using jQuery. jQuery provides "visible" selector which can be used to check the visibility. Earlier I had posted about How to check if element is empty, Difference between empty() vs remove() and Don't use jQuery.size() to count number of element. And […]
Read the rest of this entry »

How to use jQuery setTimeout function

If you want to delay your jQuery code to run after some amount of time, you can use JavaScript setTimeout function to delay the execution. setTimeout is used in JavaScript to delay execution of some code and the same function can be use with jQuery without any extra effort. Since jQuery is written on top […]
Read the rest of this entry »

Extract numbers from string using jQuery

Today I got into a situation where I need to extract the numbers from the string variable on client side using jQuery. If a string has 1 or more occurrence of the numbers then also need to extract it and store it into an array. For example, if the string is var str = '3jquery33By333Example3333'; […]
Read the rest of this entry »

How to use jQuery on() and off() method

Using jQuery .on() and .off() – AndiSmith.com jQuery 1.7 was released in month of November last year and with the jQuery 1.7, do you know that live() method is deprecated. And new method was introduced to replace live() called "on()". "jQuery on()" is a new way to attach events to selectors. The on() event handler […]
Read the rest of this entry »

How to check textbox is readonly using jQuery

Previously I had posted about "How to make textbox readonly using jQuery". One of way is to make textbox readonly is to set "readonly" attribute to true. So use the same attribute "readonly" to find out whether textbox is readonly or not using jQuery. $(document).ready(function(){ $("#txtReadonly").attr('readonly', true); var isReadonly = $("#txtReadonly").attr('readonly'); alert('txtReadonly is not readonly […]
Read the rest of this entry »

Responsive Menu
Add more content here...