Am I crazy or does $F only return the value of an element? In other words, it can''t be used to set that same value? _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services www.pridedallas.com Work (214) 351-6600 ext. 119 Mobile (214) 906-5183 _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Should only return a value I believe. $(''some_element'') works
in a
similar fashion. It doesn''t return the dom element directly in order
for you to set properties on it, only read them.
On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org>
wrote:>
>
>
> Am I crazy or does $F only return the value of an element? In other words,
> it can''t be used to set that same value?
>
> _____________________
> Thanks,
>
> Keith Davis - MCSA, A+, N+
> P.R.I.D.E. - Director of Computer Services
> www.pridedallas.com
> Work (214) 351-6600 ext. 119
> Mobile (214) 906-5183
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>
From: http://www.sergiopereira.com/articles/prototype.js.html#Dollar_F_Function Using the $F() function The $F() function is a another welcome shortcut. It returns the value of any field input control, like text boxes or drop-down lists. The function can take as argument either the element id or the element object itself. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Keith Davis Sent: Thursday, July 13, 2006 2:57 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] $F Am I crazy or does $F only return the value of an element? In other words, it can''t be used to set that same value? _____________________ Thanks, Keith Davis - MCSA, A+, N+ P.R.I.D.E. - Director of Computer Services <file://www.pridedallas.com> www.pridedallas.com Work (214) 351-6600 ext. 119 Mobile (214) 906-5183 _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
$() does return the element. $F() essentially returns $().value, but it is not a reference to that attribute. If you want to set the value and you used an id on your element then use $().value = ''blah'' to set it. Colin Andrew Kaspick wrote:> Should only return a value I believe. $(''some_element'') works in a > similar fashion. It doesn''t return the dom element directly in order > for you to set properties on it, only read them. > > On 7/13/06, Keith Davis <keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote: >> >> >> >> Am I crazy or does $F only return the value of an element? In other >> words, >> it can''t be used to set that same value? >> >> _____________________ >> Thanks, >> >> Keith Davis - MCSA, A+, N+ >> P.R.I.D.E. - Director of Computer Services >> www.pridedallas.com >> Work (214) 351-6600 ext. 119 >> Mobile (214) 906-5183 >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> >> > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
That''s not true. I set properties using $() all the time. In fact,
$().value works but $F() does not to set a value.
Keith Davis (214) 906-5183
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of
Andrew Kaspick
Sent: Thursday, July 13, 2006 2:59 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: Re: [Rails-spinoffs] $F
Should only return a value I believe. $(''some_element'') works
in a
similar fashion. It doesn''t return the dom element directly in order
for you to set properties on it, only read them.
On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org>
wrote:>
>
>
> Am I crazy or does $F only return the value of an element? In other
> words, it can''t be used to set that same value?
>
> _____________________
> Thanks,
>
> Keith Davis - MCSA, A+, N+
> P.R.I.D.E. - Director of Computer Services www.pridedallas.com Work
> (214) 351-6600 ext. 119 Mobile (214) 906-5183
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Andrew... $(''some_element'') _does_ return the DOM element
reference and does
allow you to set values and properties... I believe either you are
misunderstanding that method (which simply maps directly to
document.getElementById), or you made a typo, or I''m somehow not
reading
correctly what you typed.
On 7/13/06, Andrew Kaspick
<akaspick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Should only return a value I believe. $(''some_element'')
works in a
> similar fashion. It doesn''t return the dom element directly in
order
> for you to set properties on it, only read them.
>
> On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> >
> >
> >
> > Am I crazy or does $F only return the value of an element? In other
> words,
> > it can''t be used to set that same value?
> >
> > _____________________
> > Thanks,
> >
> > Keith Davis - MCSA, A+, N+
> > P.R.I.D.E. - Director of Computer Services
> > www.pridedallas.com
> > Work (214) 351-6600 ext. 119
> > Mobile (214) 906-5183
> >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
> >
> >
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I haven''t been able to set properties using $(). I was referencing a
checkbox with this yesterday such as $(''checkbox'').disabled =
false
and this threw a js error saying disabled was undefined or something
similar. Perhaps I''m using an older version or doing something very
slightly wrong, cause I''ve never had this work for me.
On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org>
wrote:> That''s not true. I set properties using $() all the time. In fact,
> $().value works but $F() does not to set a value.
>
>
> Keith Davis (214) 906-5183
>
> -----Original Message-----
> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of
> Andrew Kaspick
> Sent: Thursday, July 13, 2006 2:59 PM
> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Subject: Re: [Rails-spinoffs] $F
>
> Should only return a value I believe. $(''some_element'')
works in a
> similar fashion. It doesn''t return the dom element directly in
order
> for you to set properties on it, only read them.
>
> On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> >
> >
> >
> > Am I crazy or does $F only return the value of an element? In other
> > words, it can''t be used to set that same value?
> >
> > _____________________
> > Thanks,
> >
> > Keith Davis - MCSA, A+, N+
> > P.R.I.D.E. - Director of Computer Services www.pridedallas.com Work
> > (214) 351-6600 ext. 119 Mobile (214) 906-5183
> >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
> >
> >
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
Yep, you''re definitely doing something wrong somewhere, or using a
wrong
version of something... sounds like in your example
$(''checkbox'') is not
finding the element, meaning you are either not using the correct id for the
element in question, or perhaps you are trying to do this before the element
is actually loaded into the page. Attach element referencing code to the
body''s onload event... or if you''re into spaghetti scripting,
put the script
tag at the bottom of the page or after the innerHTML or DOM insertion voodoo
in the case this is all in an AJAX context...
...point being... something is amuck, man...
On 7/13/06, Andrew Kaspick
<akaspick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> I haven''t been able to set properties using $(). I was
referencing a
> checkbox with this yesterday such as
$(''checkbox'').disabled = false
> and this threw a js error saying disabled was undefined or something
> similar. Perhaps I''m using an older version or doing something
very
> slightly wrong, cause I''ve never had this work for me.
>
> On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> > That''s not true. I set properties using $() all the time. In
fact,
> > $().value works but $F() does not to set a value.
> >
> >
> > Keith Davis (214) 906-5183
> >
> > -----Original Message-----
> > From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of
> > Andrew Kaspick
> > Sent: Thursday, July 13, 2006 2:59 PM
> > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > Subject: Re: [Rails-spinoffs] $F
> >
> > Should only return a value I believe.
$(''some_element'') works in a
> > similar fashion. It doesn''t return the dom element directly
in order
> > for you to set properties on it, only read them.
> >
> > On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> > >
> > >
> > >
> > > Am I crazy or does $F only return the value of an element? In
other
> > > words, it can''t be used to set that same value?
> > >
> > > _____________________
> > > Thanks,
> > >
> > > Keith Davis - MCSA, A+, N+
> > > P.R.I.D.E. - Director of Computer Services www.pridedallas.com
Work
> > > (214) 351-6600 ext. 119 Mobile (214) 906-5183
> > >
> > > _______________________________________________
> > > Rails-spinoffs mailing list
> > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> > >
> > >
> > >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
$(''checkbox'') does indeed work returning me the element. I
had to do this...
var check = $(''checkbox''); check.disabled = false;
I''ll take another look at it though, but I''ve run into this
more than once.
Thanks for the correction.
On 7/13/06, Ryan Gahl <ryan.gahl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Yep, you''re definitely doing something wrong somewhere, or using a
wrong
> version of something... sounds like in your example
$(''checkbox'') is not
> finding the element, meaning you are either not using the correct id for
the
> element in question, or perhaps you are trying to do this before the
element
> is actually loaded into the page. Attach element referencing code to the
> body''s onload event... or if you''re into spaghetti
scripting, put the script
> tag at the bottom of the page or after the innerHTML or DOM insertion
voodoo
> in the case this is all in an AJAX context...
>
> ...point being... something is amuck, man...
>
>
> On 7/13/06, Andrew Kaspick
<akaspick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > I haven''t been able to set properties using $(). I was
referencing a
> > checkbox with this yesterday such as
$(''checkbox'').disabled = false
> > and this threw a js error saying disabled was undefined or something
> > similar. Perhaps I''m using an older version or doing
something very
> > slightly wrong, cause I''ve never had this work for me.
> >
> > On 7/13/06, Keith Davis <
keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> > > That''s not true. I set properties using $() all the
time. In fact,
> > > $().value works but $F() does not to set a value.
> > >
> > >
> > > Keith Davis (214) 906-5183
> > >
> > > -----Original Message-----
> > > From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > > [mailto:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
> On Behalf Of
> > > Andrew Kaspick
> > > Sent: Thursday, July 13, 2006 2:59 PM
> > > To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > > Subject: Re: [Rails-spinoffs] $F
> > >
> > > Should only return a value I believe.
$(''some_element'') works in a
> > > similar fashion. It doesn''t return the dom element
directly in order
> > > for you to set properties on it, only read them.
> > >
> > > On 7/13/06, Keith Davis
<keithdavis-mQJYS7++JhLwMB+CN6uaIQ@public.gmane.org> wrote:
> > > >
> > > >
> > > >
> > > > Am I crazy or does $F only return the value of an element?
In other
> > > > words, it can''t be used to set that same value?
> > > >
> > > > _____________________
> > > > Thanks,
> > > >
> > > > Keith Davis - MCSA, A+, N+
> > > > P.R.I.D.E. - Director of Computer Services
www.pridedallas.com Work
> > > > (214) 351-6600 ext. 119 Mobile (214) 906-5183
> > > >
> > > > _______________________________________________
> > > > Rails-spinoffs mailing list
> > > >
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > > >
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> > > >
> > > >
> > > >
> > > _______________________________________________
> > > Rails-spinoffs mailing list
> > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > >
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> > > _______________________________________________
> > > Rails-spinoffs mailing list
> > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > >
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> > >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> >
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>