[RCD] jQuery 1.6.2 in Roundcube 0.6 beta

Stephen J. Butler stephen.butler at gmail.com
Tue Aug 23 10:02:39 CEST 2011


On Tue, Aug 23, 2011 at 2:57 AM, Roland Liebl <roland at roland-liebl.de> wrote:
> Am 23.08.2011 09:47, schrieb Stephen J. Butler:
>> On Tue, Aug 23, 2011 at 2:16 AM, Roland Liebl <roland at roland-liebl.de>
>> wrote:
>>>
>>> I can't use .val() because the selector values vary dynamically
>>> and I know only the index. Are there concerns to switch back to
>>> DOM Method (document.getElementById('myid').selectedIndex = x)?
>>
>> Isn't this what .prop() is for? Your case works for me with the latest
>> jQuery and Firefox.
>
> In the docs I don't see an example for my use-case:
>
> http://api.jquery.com/prop/
>
> Please check the ticket I posted.
>
> $('myDropdown').attr('selectedIndex',3);
>
> The dropdown position is not changed.

>From the docs, 3rd paragraph:

"For example, selectedIndex, tagName, nodeName, nodeType,
ownerDocument, defaultChecked, and defaultSelected should be retrieved
and set with the .prop() method. Prior to jQuery 1.6, these properties
were retrievable with the .attr() method, but this was not within the
scope of attr. These do not have corresponding attributes and are only
properties."

I tried your example with this setup (through console) and it changed
the selection for me:

http://pastebin.com/DNiCBAy1

$("#foo").prop( "selectedIndex", 3 ) changes the select to "Four".
_______________________________________________
List info: http://lists.roundcube.net/dev/
BT/aba52c80



More information about the Dev mailing list