最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery html() in Firefox (uses .innerHTML) ignores DOM changes

 更新時(shí)間:2010年03月05日 23:12:59   作者:  
Firefox doesn't update the value attribute of a DOM object based on user input, just its valueproperty - pretty quick work around exists.
DOM:
復(fù)制代碼 代碼如下:

function DisplayTextBoxValue(){
var element = document.getElementById('textbox');
// set the attribute on the DOM Element by hand - will update the innerHTML
element.setAttribute('value', element.value);
alert(document.getElementById("container").innerHTML);
return false;
}

jQuery plugin that makes .formhtml() automatically do this:
復(fù)制代碼 代碼如下:

(function($) {
var oldHTML = $.fn.html;
$.fn.formhtml = function() {
if (arguments.length) return oldHTML.apply(this,arguments);
$("input,textarea,button", this).each(function() {
this.setAttribute('value',this.value);
});
$(":radio,:checkbox", this).each(function() {
// im not really even sure you need to do this for "checked"
// but what the heck, better safe than sorry
if (this.checked) this.setAttribute('checked', 'checked');
else this.removeAttribute('checked');
});
$("option", this).each(function() {
// also not sure, but, better safe...
if (this.selected) this.setAttribute('selected', 'selected');
else this.removeAttribute('selected');
});
return oldHTML.apply(this);
};
//optional to override real .html() if you want
// $.fn.html = $.fn.formhtml;
})(jQuery);

相關(guān)文章

最新評(píng)論

兴安县| 溆浦县| 泸西县| 双柏县| 涞水县| 大关县| 潮州市| 松江区| 玛多县| 新昌县| 尖扎县| 若尔盖县| 肃宁县| 永川市| 涟水县| 莆田市| 阜南县| 雷山县| 遂川县| 德令哈市| 正定县| 黄山市| 崇左市| 宣武区| 抚顺县| 女性| 孟村| 格尔木市| 同心县| 美姑县| 通江县| 金塔县| 河东区| 阳东县| 即墨市| 右玉县| 弥渡县| 白城市| 英山县| 酒泉市| 文安县|