Any element is highlighted due to its background-color property. By default this property has NO value, hence the element is not highlighted when it is at first added to the page. If we change the value of this property, we are easily able to highlight the element. For highlighting an element (such as a table row) on click, there are a couple of approaches using jQuery: I. Change the ‘background-color’ property of the row in the click event handler of the row. Code would be:Read More →

Scenario There may be a scenario where you are sending HTML form fields in ajax POST request or sending the value of a particular form field (let’s say input box) as a parameter in ajax request. For Example, suppose there is an input box on a web page with id “userName” and you send its value to the server in an ajax request as :Read More →

What is tag name ? There are various types of HTML elements such as input elements, anchor tags, drop downs etc. Each element has a unique syntax by which it is defined and identified. This syntax is its tag name. For Example, an input element is defined using <input> tag, anchor element by <a> tag, drop down by <select> tag and so on.Read More →

Selecting an element of a web page means to get a reference to an element (or simply getting the element) so that actions may be performed over the element. Actions cover hiding / showing the element, removing it from the page, getting its value, getting its text, modifying its value / text etc. Examples of elements on a web page are text box, button, drop down, checkbox, radio button, span, div etc. There are 4 ways to select an element in jQuery: Using id of element, Using class of element, Using an attribute of element and its value, Using another element as a reference. WeRead More →

There are scenarios where you want to silently post a form to server or submit a form without a page refresh. Typical example is a Facebook page where you comment on a post. When you comment, the page is not refreshed but the comment is saved somewhere on the server which means that a save request is sent without entire page submit. This involves the use of ajax. As soon as we decide to use ajax, a question arises as to how we would send form data from jsp to server without page submit and there would be a big hassle involved in form dataRead More →

There are many operations which we have to perform on select boxes (or drop downs) such as selecting an option based on index, selecting an option based on visible text, removing an option etc. using jQuery. Most of the times, we do not remember the selectors or methods to accomplish the required task and we end up searching the Internet giving away our valuable time. In this post, I have tried to accumulate various operations and their methods which should be helpful to many. Read On !!!Read More →

Suppose we have more than two input boxes on which we want to apply calendar. A jQuery datepicker can be applied to an input box using: $(“#calendarField”).datepicker(); Where we have used the id of element (after “#”).Read More →