Search code examples
htmlcsshrefextend

Pressing the href link has no action


I use this script to create a pull down box, works perfectly excepting a single thing. If i add a link in that box, pressing it will result in no action. Shortly the links don't work in this script. Could anyone tell me what's wrong?

Script:

 function prepareList() {
     $('#expList').find('li:has(ul)')
         .click(function (event) {
             if (this == event.target) {
                 $(this).toggleClass('expanded');
                 $(this).children('ul').toggle('medium');
             }
             return false;
         })
         .addClass('collapsed')
         .children('ul').hide();
};
$(document).ready(function () {
    prepareList()
});

Solution

  • Your event handler is trapping the click on the URL and the "return false" is cancelling it.

    Try removing the false.. not sure you need it in this implementation..

    Andrew