I'm using the following script in the WordPress functions.php file to disable top level parent items when they have a submenu. It works perfectly, but I need to it actually work like this:
If someone is using a mouse and clicks on the link - go ahead and load the parent link If someone is using a keyboard and tabbing through - if they enter on the parent link - don't load it
Right now, it's blocking the link on the both. Any help would be appreciated.
function jqueryscript_in_head(){ ?>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function () {
$j("li:has(ul)").children("a").click(function () {
return false;
}); });
</script>
<?php }
add_action('wp_head', 'jqueryscript_in_head');