$(function(){ var isBox = false; $("#select").hide(); $("#input_select").focus(function () { $(this).siblings("#select").show(); isBox = true; }); $("#mousemove").mousemove(function () { isBox = true; }); $("#mousemove").mouseout(function () { isBox = false; }); $("#input_select").blur(function () { if (isBox == true) return false; $("#select").hide(); }); $("#select").find('li').each(function () { $(this).on("click", function () { isBox = false; var text = $(this).text(); $("#input_select").val(text); $("#select").hide(); }) })})
jquery怎樣把代碼封裝成插件在各個頁面中調用,不用寫相同的類名ID名?
江戶川亂折騰
2019-03-14 18:15:45