How to check if an element has a class using jQuery / How to check the presence of a class on an element using jQuery

Overview

A web element may have an attribute class with some value. An example is <input type = "text" class = "myClass"/>. The value of class name may represent a CSS(Cascading Style Sheet) styling rule which will be applied on elements having this class such as .myClass{ background-color : blue} or it may be used to distinguish it from other elements which do not have this class.

(more…)

Continue Reading

How to highlight a table row on click using jQuery

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: (more…)

Continue Reading

Encoding (+) symbol in ajax request jQuery / jQuery ajax request removing (+) sign / How to send ‘+’ through AJAX post

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 :

(more…)

Continue Reading
Close Menu

Never Miss an article !

Get the new post delivered straight into your inbox, enter your email and hit the button

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

codippa will use the information you provide on this form to be in touch with you and to provide updates and marketing.