In my CSS design, I have multiple div elements that each need an onclick function. I would like to write the click function once and specify different actions based on whether the element clicked is an 'a' or 'b' element.
Can someone guide me on how to achieve this in jQuery?
$('.gil_Ads_BlankDock1').click(function(){
// Hide various elements
});
$('.gil_Ads_BlankDock2').click(function(){
// Hide various elements
});
$('.gil_Ads_BlankDock3').click(function(){
// Hide various elements
});
The code snippet above shows a few click functions that I want to optimize into a shorter version.