最新国产好看的视频,伊人天堂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)論

武穴市| 福海县| 长乐市| 桂东县| 册亨县| 金秀| 建宁县| 大渡口区| 三都| 红原县| 新密市| 舒城县| 松原市| 白水县| 香港| 方山县| 历史| 万载县| 乌兰察布市| 富源县| 永城市| 新密市| 老河口市| 克拉玛依市| 襄垣县| 阆中市| 吉水县| 安义县| 尉氏县| 连江县| 嵊泗县| 万年县| 开平市| 濮阳县| 洪泽县| 南康市| 南漳县| 南城县| 长宁区| 河曲县| 永寿县|