[jQuery] Re: proper way

2009-12-13 Thread Jojje
Hahaha! You dont have to apologise for that, my mother should apologise to me hahahaha Ok thank you for your very good and easy explanations on this. This was actually part of another qustion i posted here, these rules doesnt apply in this example right? $.validator.addMethod('userCheck',

Re: [jQuery] Re: proper way

2009-12-13 Thread Michael Geary
Actually the scope rules I described always apply to all JavaScript code, whether it uses jQuery or otherwise. They also apply to your $.ajax example. Consider your second version. You have a result variable declared outside your validator code. The success function is able to access this

[jQuery] Re: proper way

2009-12-13 Thread Jojje
I´m not sure i follow you on this one: Fortunately, there is a much simpler solution. In your success callback, *call a function* and pass it your ajax result. In fact, that's the reason why there is a success callback in the first place. $.ajax calls your success callback when the ajax data

[jQuery] Re: proper way

2009-12-12 Thread Jojje
Ok, thank you for your anwer :) Appreciate it! One more question. If i use the code in example 2 the function gets triggered without me clicking the link, in example 2 it gets triggered only when i click the link. Dont know if i´m doin anything wrong here? Shouldnt both examples work the same?

Re: [jQuery] Re: proper way

2009-12-12 Thread Michael Geary
No, the two examples shouldn't work the same. They are both working exactly as expected. Let me slightly rewrite each version in a more step-by-step fashion and you will see why. The first version is equivalent to: $(function() { function handleClick() { clickFunction1(); }

[jQuery] Re: proper way

2009-12-12 Thread Jojje
Oh ok :) So in order for me to pass arguments without triggering clickFunction1 immediately,and instead triggering it when the link is clicked, i have to call it through another function thats not passed any arguments? So it´s still ok to use an anonymous function like in my example to achieve

Re: [jQuery] Re: proper way

2009-12-12 Thread Michael Geary
I think you've got it! By George you've got it! (With apologies both to you and to Rex Harrison and Audrey Hepburn!) What you describe is not the only way to do it, but it's certainly a good way. You just have to understand what variables a function has access to. Of course a function can

[jQuery] Re: Proper way to detect webkit-based browsers?

2009-09-08 Thread D A
You can still use jQuery.browser.safari.  That property is true when the userAgent string contains webkit. Is that a no-no? It's listed as deprecated, so would prefer to avoid it, but perhaps that's still the only valid way until we have more features to detect? -Darrel

[jQuery] Re: Proper way to detect webkit-based browsers?

2009-09-05 Thread ryan.j
it'd probably help if i included the link ;) http://www.quirksmode.org/js/detect.html On Sep 5, 1:15 pm, ryan.j ryan.joyce...@googlemail.com wrote: It would appear this is the inevitable result of us all using feature detection rather than browser sniffing - essentially we're still doing

[jQuery] Re: Proper way to detect webkit-based browsers?

2009-09-05 Thread ryan.j
It would appear this is the inevitable result of us all using feature detection rather than browser sniffing - essentially we're still doing all the same stuff as before, but in a more roundabout way because we need to test for features specific to a browser but - and this is the important bit -

[jQuery] Re: Proper way to detect webkit-based browsers?

2009-09-05 Thread Mike Alsup
Now that we're switching to feature detection rather than browser detection, how does/should one detect for a webkit browser? Is there a known feature that we can check for that would Identify Safari and Chrome? We're running into some (rather minor) layout issues with some jquery plug-in

[jQuery] Re: Proper way of binding/unbinding event in plug-ins

2009-01-06 Thread Eridius
Anyone? Eridius wrote: Is the following syntax the proper way to bind and unbind event in plugin so that you minimize the chance you will unbind and event that you did not set? $(selector).bind('event.custom_tag', function); so if you take the following: