#9272 closed bug (invalid)
Select component and attr("selected")
Reported by: | Owned by: | ||
---|---|---|---|
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.
Change History (5)
comment:1 Changed 12 years ago by
Component: | unfiled → attributes |
---|---|
Owner: | set to [email protected]… |
Priority: | undecided → low |
Status: | new → pending |
comment:2 follow-up: 3 Changed 12 years ago by
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);
comment:3 Changed 12 years ago by
Status: | pending → new |
---|
Replying to 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....
comment:4 Changed 12 years ago by
Status: | new → pending |
---|
comment:5 Changed 12 years ago by
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.