๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
CSS๐Ÿ”ง/๋ฐ˜์‘ํ˜•

select ์˜ต์…˜ change / location.href ํ˜„์žฌ์ฐฝ ๋„์šฐ๊ธฐ

by hyojinny 2022. 11. 21.

  $('#footer .select_area select').on('change', function () {
    console.log($(this).val());
  });

 

 

 

  $('#footer .select_area select').on('change', function () {
    // location.href = $(this).val();
    window.open($(this).val(), '_black');
  });

 

๋นˆ์นธ์ด ๋– ๋ฒ„๋ฆผ

 

 

 

  $('#footer .select_area select').on('change', function () {
    // location.href = $(this).val();
    if ($(this).val()) {
      window.open($(this).val(), '_black');
    }
  });
 
 
 
๋นˆ์นธ์„ ๋ˆŒ๋Ÿฌ๋„ ์ƒˆ์ฐฝ์ด ๋œจ์ง€์•Š๊ณ  ์ฒด์ธ์ง€๊ฐ€์•ˆ๋จ
๋‹ค์‹œ๋Œ์•„์™€๋„ ๋™์ผ
 
 
  $('#footer .select_area select').on('change', function () {
    // location.href = $(this).val();
    if ($(this).val()) {
      // option์˜ ๊ฐ’์ด ์žˆ์„ ๊ฒฝ์šฐ๋งŒ ์ƒˆ์ฐฝ๋„์šฐ๊ธฐ
      window.open($(this).val(), '_black');
      // ํ˜„์žฌ์ฐฝ๋„์šฐ๊ธฐ
      location.href = $(this).val();
    }
  });

๋Œ“๊ธ€