[jQuery] Re: Preventing link clicks before document.ready();

2009-03-21 Thread Eric Garside
There is a much simpler solution, I think. I'm not positive, but try: $('a').live('click.halt', function(){return false}); $(function(){ ... $('a').die('click.halt'); }); The theory being that the live event will bind the click pause as the enter the dom, then removing the pause when you'v

[jQuery] Re: Preventing link clicks before document.ready();

2009-03-21 Thread Hector Virgen
Why is the result of clicking an link unexpected? Is Javascript required to use your website? If so, then it may be in your interest to make those links work without javascript. Then you would use Javascript to enhance the static pages. That way users without Javascript (including search engines i

[jQuery] Re: Preventing link clicks before document.ready();

2009-03-21 Thread Brad
Other have offered solutions where you hide the links, etc. A variation of that theme would be to originally display the links with some inline JS, e.g., Where myPrematureClickSentinel simply returns false. In your document.ready() $("a").removeAttr("onclick"); // get rid of all myPrematureCl

[jQuery] Re: Preventing link clicks before document.ready();

2009-03-20 Thread mkmanning
You can hide the links from users with JavaScript enabled by placing this in the head of your page: document.documentElement.className = "js"; Then hide the links (by a, or #, or class) in your CSS: .js a {display: none;} Then display them on document.ready(). On Mar 20, 12:42 pm, Jo

[jQuery] Re: Preventing link clicks before document.ready();

2009-03-20 Thread Josh Powell
You could also put the .click events inside a document.ready(). Then they can click away, but no results until the event handler is set after document.ready. On Mar 20, 12:30 pm, James wrote: > That's the default of how web browsers. You can work around it such as > by setting the display of th

[jQuery] Re: Preventing link clicks before document.ready();

2009-03-20 Thread James
That's the default of how web browsers. You can work around it such as by setting the display of those to hidden in your CSS, and use Javascript to show it upon page ready. Depending on how your website works, this may mean your page would not work properly if users do not have Javascript enabled