input와 select 조합

2915 단어


 
  
  
  
  Addr Selecter
  
  
    // , input 
    $(document).ready(function(){
        Input_ValidateCN('input_txt');
        $('#combDiv').on('change','#comb_selector',function(){
            var selectedValue = $('#comb_selector').val();
            var selectedText = $('#comb_selector').find("option:selected").text();          
            $('input[name="option_value"]').val(selectedValue);
            $('input[name="input_txt"]').val(selectedText);
        })
    });
    function Input_ValidateCN(name_selector) {
        var inputor = document.getElementById(name_selector);
        if(getBrowser() === 'IE') {
            var isInputZh = false;
            window.addEventListener('compositionstart', function (e) {  isInputZh = true;}, false);
            window.addEventListener('compositionend', function (e) {  isInputZh = false; console.log('compositionend',document.getElementById(name_selector).value )}, false);           

        } else {
          var isInputZh = false; //  ,       
          
          inputor.addEventListener('compositionstart', function (e) {  isInputZh = true;}, false); // 
          inputor.addEventListener('compositionend', function (e) {  isInputZh = false; console.log('compositionend', this.value)}, false); // 
          //inputor.addEventListener('input', function (e) { if (isInputZh) return;   ValidateNum(valDom);}, false); }        
        }
        inputor.addEventListener('input', function (e) { if (isInputZh) return; console.log('compositionend', this.value)}, false); 
    }

function getBrowser () {
  const userAgent = navigator.userAgent
  if (userAgent.indexOf('OPR') > -1) {
    return 'Opera'
  }
  if (userAgent.indexOf('Firefox') > -1) {
    return 'FF'
  }
  if (userAgent.indexOf('Trident') > -1) {
    return 'IE'
  }
  if (userAgent.indexOf('Edge') > -1) {
    return 'Edge'
  }
  if (userAgent.indexOf('Chrome') > -1) {
    return 'Chrome'
  }
  if (userAgent.indexOf('Safari') > -1) {
    return 'Safari'
  }
}
  

 
 
    

콤보 드롭다운 상자

좋은 웹페이지 즐겨찾기