JavaScript 코드/jquery 코드를 반복하여 반복하지 않으려 고합니다.클릭 이벤트와 독립적 인 jquery 함수를 만들고 페이지로드시 실행하십시오.
$(".dropdown-menu-methods li a").click(function(){
$("#button-methods:first-child").text($(this).text());
$("#button-methods:first-child").val($(this).text());
selected_val = $(this).attr("id");
element_id = ["_panel_container", "_panel_msg"];
clear_content(element_id);
if (selected_val == "excel_layer"){
$("#_panel_container").append('<i>"Choose an existing layer </i>);
...
이 기능은 버튼 클릭을 실행하지만 변수를 전달하여 언제 그것을 실행할 수 있도록하고 싶습니다 : 사용자가 드롭 다운 메뉴에서 값을 선택할 때 나는 실행되는 클릭 이벤트를 가지고 그것. 어떻게하면됩니까? 클릭 이벤트에서 기능을 분리하고 페이지로드시 실행하십시오.
을 원하는 많은 인수로 전달 될 수있다' change 이벤트를'click '보다'수동으로 '호출 할 수 있습니다. change()' – guradio