Hi Norbert, If you read up on the jQuery click event http://docs.jquery.com/Events/click you will see that it binds a click listener to whatever element you apply it to so in your case:
$("#fake_href").click(); <- this is 'listening' for a user to click on some element with id = #fake_href, so unless a user actually clicks on that element (a tag) it will never fire and jQuery will never do anything in regards to that bit of code. This is where that link to "trigger" comes in handy (http:// docs.jquery.com/Events/trigger) because you actually want to cause a click event to happen, not merely wait for one happen. try this instead of $("#fake_href").click(); do: $("#fake_href").trigger('click').stopPropagation(); the stopPropagation, from what I have read should stop any unwanted side effects from that click event being accessible by anything else on the page. Give it a try and let me know. This assumes you are using jQuery 1.3 or newer. On Nov 10, 8:02 pm, norbi <norbe...@post.pl> wrote: > I am even more confused right now. > > I decided to create fake <a> outside <li> to avoid the propagation > issue. > > $(document).ready(function(){ > > $("#menu_ma a") > .click(function(e,a){ > > $(this).closest("li.ui-selectee").addClass("ui-selected").siblings > ().removeClass("ui-selected"); > }) > > $("#menu_ma li") > .hover( > function(){ > $(this).addClass("ui-state-highlight cursor-pointer"); > }, > function(){ > $(this).removeClass("ui-state-highlight > cursor-pointer"); > }) > .click(function(e,a){ > link=$(this).find("a").attr("href"); > if(link!=undefined){ > var link = $(this).find("a"); > $("#fake_href") > .attr("href",link.attr("href")) > .attr("target",link.attr("target")) > } > > $("#fake_href").click(); > > }) > }); > > Function is rewriting href and target attributes and then clicks on > that fake link. > But this does not make browser behave like link was clicked. I can see > in firebug that fake link obtains proper link and target, but page is > not reloaded. > > Can somebody answer why? > > Brgs > Norbert