Hi Hissam,
If you have 5 div :
$(function(){
$('.common').click(function(e){
$('.common').hide();
var targetId = e.target.id;
$('#'+targetId).show();
});
});
<div id="1" class="common"></div>
<div id="2" class="common"></div>
<div id="3" class="common"></div>
<div id="4" class="common"></div>
<div id="5" class="common"></div>
try with this .
cheers.
On Mon, Apr 13, 2009 at 6:50 PM, Eric Garside <[email protected]> wrote:
>
> Take a look at the jQuery UI Accordion plugin.
>
> http://ui.jquery.com
>
> On Apr 13, 6:30 am, HISSAM <[email protected]> wrote:
> > Hey I'm new to JQuery
> >
> > I have 5 divs
> > At a time only 1 div should be expanded the others must be hidden
> >
> > I'm using the show and hide function
> > But I want to function parameterised to open the respective div and
> > hide the other which is open
> >
> > How do I go about ??
>