0

I want my links not to have the weird outline and the best way I found to solve this is have a "null link" to focus on after a click. This works great when defining the onclick method inline the HTML but that is not ideal. I wrote a quick jQuery snippet to do this instead, but I am having trouble getting it to work. Here it is:

<script type="text/javascript" charset="utf-8">
    $j(document).ready(function () {
        //alert($j('#ml_table thead a').length);
        $j('#ml_table thead a').click( function (){
            $j('#null_link').focus(); return false;
        });
    });
</script>

Does anyone see any problems with this? The alert spits out 8 which is the correct number of anchor elements so I know the selector is working properly. The jQuery docs say that I don't have to iterate through the array of elements.

Thanks!

1 Answer 1

3

Try css:

#ml_table thead a {
    outline:none;
}

And for IE:

$('#ml_table thead a').attr('hidefocus', true)

References:

But yeah, to answer your direct question the one click function is applied to the 8 anchors it found.

That focus trick looks kinda funky. If you really want to keep it you can try instead:

$j('#ml_table thead a').click(function () {
    $(this).blur();
    return false;
})
Sign up to request clarification or add additional context in comments.

1 Comment

actually I think the issue is that I am using sortable which is overwriting the onclick function to sort the table...oops

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.