This article will show you the collection of jQuery CSS
functions. Here I will show you some of the example of the how to manage Css
class using jQuery functions.
Some of my previous articles are as follows:
jQuery
DatePicker Calendar With Slide Effect on TextBox Click In Asp.Net, jQuery
DatePicker Calendar With Fold Effect on TextBox Click In Asp.Net, jQuery
DatePicker Calendar With Drop Effect on TextBox Click In Asp.Net, jQuery
DatePicker Calendar With Clip Effect on TextBox Click In Asp.Net, jQuery
DatePicker Calendar With Blind Effect on TextBox Click In Asp.Net, jQuery
Datepicker Calendar With Fold Effect Using jQuery In Asp.Net.
So here are the jQuery css functions.
.addClass()
This function is used for assigning the class of the control
in your html control. This function you can use in aso.net, HTML, Asp.net MVC.
Eg: Suppose you
have a div control id=”divName” and
you want to assign the class backgroundColor.
$( "#divName” ).addClass( " backgroundColor
" );
|
.removeClass()
This function is used for removing the assign class of the
control in your html control. This function you can use in aso.net, HTML, Asp.net
MVC.
Eg: Suppose you
have a div control id=”divName” and
you want to assign the class backgroundColor.
$( "#divName” ). removeClass( "
backgroundColor " );
|
Here is a trick. You can use addClass and removeClass
together. Please check the below example. Suppose you have a div control id=”divName” and you want to assign the class backgroundColorGreen and you want to assign class backgroundColorRed.
$( ""#divName" ).removeClass( "
backgroundColorGreen "
).addClass( " backgroundColorRed
" );
|
.hasClass()
This function is used for validating weather the control is
having the defined class or not. It will return true or false. This function
you can use in aso.net, HTML, Asp.net MVC.
Eg: Suppose you
have a div control id=”divName” and
you want to check the class backgroundColor.
$( "#divName” ). hasClass ( "backgroundColor " );
|
The above will return true.
I hope this small article will help you.
0 comments:
Please let me know your view