rather than removing the href you could use the preventDefault
function, which will leave the href intact should you want to unbind
it at a later date.

usage is something like..

$('a.submit-button').click(function(e){
        e.preventDefault();
        doSubmit( $(this).html() );
})

On Sep 24, 5:32 pm, osu <onesiz...@googlemail.com> wrote:
> Thanks Andi,
>
> Yes, I meant an unordered list as you showed.
>
> Rather than remove the <a> tag, is it possible to just 'deactivate'
> it? i.e. when you click it, nothing happens, but the <a> tag stays in
> place?
>
> I ask, because I'd like to keep the CSS as simple as possible.
>
> Thanks,
>
> osu
>
> On Sep 24, 6:05 pm, Andi23 <dowhatyouw...@gmail.com> wrote:
>
> > First of all, let's clarify the actual HTML.  I assume this is what
> > you have:
> > <ul>
> >     <li><a href="#">Link 1</a></li>
> >     <li><a href="#">Link 2</a></li>
> >     <li><a href="#">Link 3</a>
> >         <ul>
> >             <li><a href="#">Link 3a</a></li>
> >             <li><a href="#">Link 3b</a></li>
> >             <li><a href="#">Link 3c</a></li>
> >         </ul>
> >     </li>
> >     <li><a href="#">Link 4</a></li>
> > </ul>
>
> > When you say "remove the link", I assume you want to turn this:
> > <li><a href="#">Link 3</a>
> > into this:
> > <li>Link 3
>
> > Given that, try this jQuery:
> > $("li ul").siblings("a").each(function(){
> >     $(this).replaceWith($(this).html());
>
> > });

Reply via email to