Hi,

I've got a very simple tab interface which works perfectly, except in Safari.

The click event is carried out, then the link is followed even with
return false in the click event function. I've simplified everything
to the following code, but the tabs are still treated as in-page
anchors rather than simple click handles.

(normally, of course, the tabs() would initialise by hiding the
non-current months and would toggle a 'hidden' class on months you
clicked on, etc. It's just an alert to illustrate)

$(document).ready(function() {
        tabs("#calendar .navigation");
});

function tabs(nav){
        $(nav + " li a").click(function(){
                alert('hello');
                return false;
        });
}

<div id="calendar">
<div class="navigation">
        <ul>
                <li><a href="#jan" >Jan</a></li>
                <li class="current"><a href="#feb" >Feb</a></li>
                <li><a href="#mar" >Mar</a></li>
                <li><a href="#apr" >Apr</a></li>
                <li><a href="#may" >May</a></li>
                <li><a href="#jun" >Jun</a></li>
                <li><a href="#jul" >Jul</a></li>
                <li><a href="#aug" >Aug</a></li>
                <li><a href="#sep" >Sep</a></li>
                <li><a href="#oct" >Oct</a></li>
                <li><a href="#nov" >Nov</a></li>
                <li><a href="#dec" >Dec</a></li>
        </ul>
</div>
<div class="month" id="jan">
   <h2>January</h2>
</div>

...

<div class="month" id="dec">
   <h2>December</h2>
</div>
</div>

Thanks,

Dan.

-- 
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

Reply via email to