$(function() { //getip에다가 글쓸때 $(".getIP").on("input",function() { $(".getIPul").empty(); $(".getIPul").hide(); var ul=$(this).parent().children("span").children("ul"); if($(this).val()=="") { ul.hide(); return; } // ul.empty(); var sendData = "getIP="+$(this).val()+"&getClient_Code="+$(".client_code").val()+"&getClient_Name="+$(".client_name").val(); $.ajax( { url:"IdcGetIPList.jso", data:sendData, dataType:"json", type:"post", cache:false, success:function(data) { createIPList(data[0].a,ul); }, error:function() { alert(" 에서의 Error"); } }); ul.show(); }); //ip리스트 눌렀을 경우 $(document).on("click",".selIP",function() { $(this).parents("div").children(".getIP").val($(this).attr("value")); $(this).parents("div").children(".getIPt").val($(this).attr("value")); $(this).parents("div").children(".getIPc").val($(this).attr("value")); $(".getIPul").hide(); }); }); var createIPList=function(data,ul) { for(var i=0;i"); var a=$(""); a.addClass("btn btn-default selIP").attr("value",data[i]).html(data[i]); li.append(a); ul.append(li); } }