Side navigation
#1074 closed bug (fixed)
Opened March 27, 2007 06:00AM UTC
Closed November 17, 2007 10:14PM UTC
$.html(val) can not be used to Select Element
Reported by: | clmm | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var optionStr = "<option value="-1" '''selected="selected"'''>é¸æŠž</option>"; jQuery.each(fileNameArr,function(i,n){ optionStr += "<option value=""+i+"">"+n+"</option>"; });
The option which value is "-1" will be selected as suppose.
But $.html(val) look like no useless to this.
correct: document.getElementById('search-type').innerHTML = optionStr;
correct: jQuery("#search-type").get(0).innerHTML = optionStr;
wrong: jQuery("#search-type").html(optionStr);
Attachments (0)
Change History (2)
Changed July 21, 2007 01:47PM UTC by comment:1
description: | {{{\ var optionStr = "<option value="-1" '''selected="selected"'''>é¸æŠž</option>";\ jQuery.each(fileNameArr,function(i,n){\ optionStr += "<option value=""+i+"">"+n+"</option>";\ });\ }}}\ \ The option which value is "-1" will be selected as suppose.\ But $.html(val) look like no useless to this.\ \ correct: document.getElementById('search-type').innerHTML = optionStr; \ correct: jQuery("#search-type").get(0).innerHTML = optionStr; \ wrong: jQuery("#search-type").html(optionStr);\ \ \ \ → {{{ \ var optionStr = "<option value="-1" '''selected="selected"'''>é¸æŠž</option>"; \ jQuery.each(fileNameArr,function(i,n){ \ optionStr += "<option value=""+i+"">"+n+"</option>"; \ }); \ }}} \ \ The option which value is "-1" will be selected as suppose. \ But $.html(val) look like no useless to this. \ \ correct: document.getElementById('search-type').innerHTML = optionStr; \ correct: jQuery("#search-type").get(0).innerHTML = optionStr; \ wrong: jQuery("#search-type").html(optionStr); \ \ \ \ |
---|---|
milestone: | 1.1.3 → 1.1.4 |
owner: | → john |
version: | 1.1.2 → 1.1.3 |
Changed November 17, 2007 10:14PM UTC by comment:2
milestone: | 1.1.4 → 1.2.2 |
---|---|
resolution: | → fixed |
status: | new → closed |
Fixed in [3844].