I have a page with three HTML labels and their corresponding ASP.NET gridviews contained within divs. Now while learning jQuery, I am trying to achieve two things:
1. Change the css class of the lables upon mouse hover/out.
2. Slide up/down the grid div upon clicking of the labels.
It looks to be working as expected, but I wish to know if I am doing it the right way.
My complete jQuery code is:
$(function ColorChange(ID) {
$("#" + ID).toggleClass("gridLabel");
});
$(function ShowHide(GID) {
$('#' + GID).slideToggle('slow');
});
And I am calling these function from onmouseover, onmouseout and onclick events of the label controls passing in the label ID as parameter. As an example:
<label id="lblWebComp" class="gridLabelDefault" onmouseover="ColorChange('lblWebComp')"
onmouseout="ColorChange('lblWebComp')" onclick="ShowHide('gvDivWC')">
Web Components
</label>
Kindly let me know if this is the best way to achieve these effects? Don't I have to right the document ready function in the jQuery code?
Thanks a lot!