国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

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

2019-11-21 00:41:54
字體:
來源:轉載
供稿:網友
DOM:
復制代碼 代碼如下:

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:
復制代碼 代碼如下:

(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);
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 普定县| 东明县| 新干县| 竹山县| 道真| 阆中市| 甘泉县| 平顶山市| 郯城县| 凤凰县| 泽普县| 布拖县| 漾濞| 融水| 新密市| 西吉县| 尼玛县| 清河县| 年辖:市辖区| 阿拉善左旗| 台东市| 北宁市| 蓬溪县| 平安县| 图们市| 平定县| 石泉县| 罗源县| 九台市| 仪征市| 东乌珠穆沁旗| 宜兴市| 遵义县| 皮山县| 本溪市| 海晏县| 嘉荫县| 建昌县| 牡丹江市| 罗甸县| 中牟县|