All jQuery Tips

jQuery code to disable “Enter” key

Got a strange requirement from my client that whenever the "Enter" key is pressed on the page, the page should not be submitted. It should only be submitted when user clicks the submit button using mouse. Well, this was pretty simple and easy with jQuery. I have implemented it in 2 mins and thought of […]
Read the rest of this entry »

jQuery code to handle broken (not found) images in webpage

In this post, find out jQuery code to handle broken link images or not found images on a webpage. This can happen when path of the image is changed or it is removed or renamed. But this can be answered easily with jQuery. When the image is not loaded properly, use jQuery error event on […]
Read the rest of this entry »

jQuery code to hide table rows with empty td element

Find jQuery code to hide those table rows (<tr>) which have at least one or more <td> element as empty or with no value. To hide table rows, iterate through all the td element and check it's text. If it is empty then hide it's parent (which is tr) using .hide(). Related Post: jQuery code […]
Read the rest of this entry »

jQuery code to highlight empty table element

Find jQuery code to highlight those <td> elements within a table/ Grid/ GridView/ DataGrid which have no value associated with it or which are empty. All is required is to loop through all the <td> element and check it's value. If it is empty, then assign background color to it so that it looks highlighted. […]
Read the rest of this entry »

Sort Dropdown list items using jQuery

In this post, find out jQuery code to sort dropdown list items. The items can be sorted by item's text or by item's value in ascending or descending order. Related Post: Common Dropdown operation using jQuery How to Reset DropDown using jQuery How to Disable DropDown List Item using jQuery To sort the items, use […]
Read the rest of this entry »

How to Change ID of DOM element using jQuery

In this short and quick post, find out how to change or reset ID of any HTML DOM element using jQuery. To Change/Reset element ID, just need to change the value of "id" attribute. Below jQuery code changes ID of "dvDemo" element to "dvDemoNew". $('#dvDemo').attr('id', 'dvDemoNew'); See result below See Complete Code Feel free to […]
Read the rest of this entry »

Responsive Menu
Add more content here...