[Javascript] Hopefully quick question.

Troy III Ajnej trojani2000 at hotmail.com
Sun Oct 4 12:50:07 CDT 2009


Yeah, this one was quick and brief too!

:')

 

I wonder though:

-Why do people use things like: 

var Obj = $('mydiv'); now?

 

I mean - instead of the "beloved": 

document.getElementById('mydiv');

 

Regards.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      Troy III
                         progressive art enterprise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
> From: david at dorward.me.uk
> Date: Sat, 3 Oct 2009 20:03:58 +0100
> To: javascript at lists.evolt.org
> Subject: Re: [Javascript] Hopefully quick question.
> 
> On 3 Oct 2009, at 19:36, Terry Riegel wrote:
> 
> > I have this construct...
> >
> > <script>
> > var obj=$('mydiv');
> > obj.onclick=function() {
> > alert(obj.id);
> 
> > I want to pass that function the value of obj at the time it is set 
> > up.
> 
> 
> Possible, but this is easier:
> 
> obj.onclick=function() {
> alert(this.id);
> 
> -- 
> David Dorward
> http://dorward.me.uk
> 
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript

 		 	   		  
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/


More information about the Javascript mailing list