Hi. Have you tried not passing $ into function calls? $ is global
variable, so it's available in every function defined after jquery
code.

On 16 мар, 08:46, syuji <syujik...@gmail.com> wrote:
> Hi there,
>
> I've just dived into jquery and now I'd like to know what's the best
> way to define functions in external js. ( Those functions need a
> jquery reference. )
>
> I have two files: index.html and logic.js
>
> * Inside index.html
>
> <script language="javascript">
> $(function(){
>   write_something_in_myname_div($, "hello !");
>   write_something_in_myname_div($, "hello hello good-bye!");});
>
> </script>
> <div id="myname"></div>
>
> * Inside logic.js
>
> function write_something_in_myname_div($,message){
>   $.('#myname').html(message);}
>
> ....
>
> As you can see, I'm passing a jquery reference to all functions in
> logic.js.
> I know that's stupid but I don't know any better ways...
>
> So now I want to ask you guys, what's the best (or standard) way to
> define functions in external js where functions need a jquery
> reference.
>
> thanks
>
> -syuji

Reply via email to