Side navigation
#9272 closed bug (invalid)
Opened May 13, 2011 10:23AM UTC
Closed May 31, 2011 07:55AM UTC
Last modified March 14, 2012 06:15AM UTC
Select component and attr("selected")
Reported by: | jeflbtest@yahoo.fr | Owned by: | jeflbtest@yahoo.fr |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | attributes | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hello,
Since jQuery 1.6 and 1.6.1, I'm trying to make working my intranet site, but it's hard to make it compatible with IE6 and IE>6 , OPERA.
My problem was to select dynamics values after charging data.
This was ok in 1.5.2 but not anyway since >1.6
I tried to use prop() function with :
$("#myList").find("option[value=\\"" + myConf.code + "\\"]").attr("selected",true) but not ok with IE6!
IE 6 must have "true" (double quoted) value instead of true !
This value "true" isn't compatible with OPERA
The only way I found, to make it compatible in my code, I added :
if(isIE6)
{
valSelected = "true";
}
else
{
valSelected = "selected";
}
.....
$("#myList").find("option[value=\\"" + myConf.code + "\\"]").attr("selected",valSelected );
AND
mySeletedValue = $("#myList").find("option[selected=" + valSelected + "]").attr("value");
I hope this code could help somebody.
Jeff.
Attachments (0)
Change History (5)
Changed May 13, 2011 10:36AM UTC by comment:1
component: | unfiled → attributes |
---|---|
owner: | → jeflbtest@yahoo.fr |
priority: | undecided → low |
status: | new → pending |
Changed May 13, 2011 04:55PM UTC by comment:2
FWIW, the recommended way to set an option in a select to be selected if you know its value is to use the .val() method directly on the select itself. For instance:
$("#myList").val(myConf.code);
Changed May 16, 2011 07:17AM UTC by comment:3
status: | pending → new |
---|
Replying to [comment:2 ajpiano]:
FWIW, the recommended way to set an option in a select to be selected if you know its value is to use the .val() method directly on the select itself. For instance:> $("#myList").val(myConf.code); >
Thanks for this but it's what I done before 1.6.1, this code doesnt work in IE6.
It throws an IE6 exception : Impossible to set selected property....
Changed May 16, 2011 02:58PM UTC by comment:4
status: | new → pending |
---|
Changed May 31, 2011 07:55AM UTC by comment:5
resolution: | → invalid |
---|---|
status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket!
Additionally, test against the
jQuery (edge)
version to ensure the issue still exists.