- 設置元素css樣式值
document.getElementById("imgUpload").style.height = imgOriginHeight;
- 改變元素class樣式
document.getElementById("btnLockSizes").className = "cke_btn_unlocked";
- 獲取文本框的值
//text類型
var value = document.getElementById("height_input").value;
//file類型
var file = document.getElementById("file").files[0];
- 獲取元素屬性
document.getElementById("imgUpload").width
- 動態屬性值
CKEDITOR.instances.editor_editor.insertHtml("

");
- 刪除一個父元素下面的所有子元素
document.getElementById("ccc").innerHTML = " ";
- 刪除其中的一個
document.getElementById("ok").remove(document.getElementById("ok").children(i));
- js判斷對象是否為空
if(JSON.stringify(object) === "{}")
- atts的困惑
$(this).attrs('id'); ------------result: "419"
$(this).attrs("id")[0]; ------------result: 4
$(this).attrs("id")[1]; -------------result: 1
$(this).attrs("id")[2]; -------------result: 9
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。