前端(js、jquery等)

$(document).ready(function(){
});

這是爲了防止文檔在完全加載(就緒)之前運行 jQuery 代碼。


$(document).ready(function) 將函數綁定到文檔的就緒事件(當文檔完成加載時)
$(selector).click(function) 觸發或將函數綁定到被選元素的點擊事件
$(selector).dblclick(function) 觸發或將函數綁定到被選元素的雙擊事件
$(selector).focus(function) 觸發或將函數綁定到被選元素的獲得焦點事件
$(selector).mouseover(function) 觸發或將函數綁定到被選元素的鼠標懸停事件


//遍歷input標籤name爲checkbox
$("input[name='checkbox'']").each(function(){
相關操作
});



jsp取值和賦值               
                                 取值                                                                                                     賦值 
                     var a = document.getElementById("id").value;               document.getElementById("id").value = a; 
                     val a = $("#id").val();                                                             $("#id").val("值");
                     var a = $("#id").attr("value");                                                $("#id").attr("value",值);


onunload()窗口關閉時會觸發的事件

       例:<script>

                 function unLoad(){

                       //  所做的相關操作

                 }

              </script>

<body style="background:#f7faff;" οnunlοad="unLoad()">


清空select

清空:
$("#search").find("option").remove();
或者
$("#search").empty();



發佈了30 篇原創文章 · 獲贊 3 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章