JQuery - how to get selectedIndex from a select list?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

JQuery - how to get selectedIndex from a select list?

squeakman
Greetings,

I am learning how to use JQuery with Seaside.  I have a <select> list
and I want to get the selectedIndex when the user clicks on an item in
the list.

The code below returns 'nil' for the value in the callback block - at
the "self halt"

I am using JQuery 1.6.

Any help would be very much appreciated.

Thanks,
Frank


renderContentOn: html

   (html select)
      id: #selList;
      list: aList;
      onClick: (html jQuery ajax
         callback: [:v | self halt]
         value: ((html jQuery id: #selList) property: 'selectedIndex'))

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQuery - how to get selectedIndex from a select list?

dtrussardi@tiscali.it

Ciao,

try something like this:

         (html select)
    id: #selList;
  list: aList;
                callback: [:v | self halt]
    onClick: (html jQuery ajax serializeThis)

It's return the value selected.

I hope this help.

        Dario


> Greetings,
>
> I am learning how to use JQuery with Seaside.  I have a <select> list and I want to get the selectedIndex when the user clicks on an item in the list.
>
> The code below returns 'nil' for the value in the callback block - at the "self halt"
>
> I am using JQuery 1.6.
>
> Any help would be very much appreciated.
>
> Thanks,
> Frank
>
>
> renderContentOn: html
>
>  (html select)
>     id: #selList;
>     list: aList;
>     onClick: (html jQuery ajax
>        callback: [:v | self halt]
>        value: ((html jQuery id: #selList) property: 'selectedIndex'))
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQuery - how to get selectedIndex from a select list?

xx397
In reply to this post by squeakman
On 09/11/2012 14:57, squeakman wrote:

> Greetings,
>
> I am learning how to use JQuery with Seaside.  I have a <select> list
> and I want to get the selectedIndex when the user clicks on an item in
> the list.
>
> The code below returns 'nil' for the value in the callback block - at
> the "self halt"
>
> I am using JQuery 1.6.
>
> Any help would be very much appreciated.
>
> Thanks,
> Frank
>
>
> renderContentOn: html
>
>   (html select)
>      id: #selList;
>      list: aList;
>      onClick: (html jQuery ajax
>         callback: [:v | self halt]
>         value: ((html jQuery id: #selList) property: 'selectedIndex'))
>
> _______________________________________________
>
Very close! Try propertyAt: :-)

Chris

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQuery - how to get selectedIndex from a select list?

squeakman
On 09/11/2012 10:36 AM, Chris wrote:

> On 09/11/2012 14:57, squeakman wrote:
>> Greetings,
>>
>> I am learning how to use JQuery with Seaside.  I have a <select> list
>> and I want to get the selectedIndex when the user clicks on an item in
>> the list.
>>
>> The code below returns 'nil' for the value in the callback block - at
>> the "self halt"
>>
>> I am using JQuery 1.6.
>>
>> Any help would be very much appreciated.
>>
>> Thanks,
>> Frank
>>
>>
>> renderContentOn: html
>>
>>   (html select)
>>      id: #selList;
>>      list: aList;
>>      onClick: (html jQuery ajax
>>         callback: [:v | self halt]
>>         value: ((html jQuery id: #selList) property: 'selectedIndex'))
>>
>> _______________________________________________
>>
> Very close! Try propertyAt: :-)
>
> Chris
Brilliant, that worked perfectly. Thanks

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside