Top

¸µÅ© ÆäÀÌÁöÀ̵¿ ¸·±â | Web-Programing
±è°æÈÆ (admin) | Editor | 2016/04/14 18:11:20 | Á¶È¸:7821

ÆäÀÌÁöÀÇ ¸µÅ© Ŭ¸¯½Ã ÆäÀÌÁö À̵¿ ¸·´Â ¹æ¹ý.



- HTML -

  1. <div class="nolink">
  2. <a href="http://google.com" target="_blank">google</a>
  3. <a href="javascript:location.href='http://naver.com'" target="_blank">google2</a>
  4. <a href="javascript:;" onclick="location.href='http://naver.com'" target="_blank">google3</a>
  5. <button onclick="location.href='http://naver.com'">naver</button>
  6. </div>


- JS -

  1. jQuery(function($){
  2.     var $preview_zone = $('.nolink');
  3.     var msg = 'alert message';
  4.     $preview_zone
  5.       .find('a, [onclick]').on('click', function(){
  6.         alert(msg);
  7.         return false;
  8.       })
  9.       .prop('onclick', null);
  10.     ;
  11. });



 attr°ú prop´Â ºñ½ÁÇÑµí ´Ù¸£´Ù.

 attrÀº ¼Ó¼ºÀ» ¹®ÀÚ¿­·Î »ç¿ëÇÒ ¶§ "checked" ·Î, prop´Â ¼Ó¼ºÀ» BooleanÀ¸·Î »ç¿ëÇÒ ¶§ true, false ·Î »ç¿ëÇÑ´Ù.

  1. // Correct if changing the attribute is desired
  2. $(elem).attr("checked", "checked");
  3. // Correct for checking the checkbox
  4. $(elem).prop("checked", true);
  5. // Correct if removing the attribute is desired
  6. $(elem).removeAttr("checked");
  7. // Correct for clearing the checkbox
  8. $(elem).prop("checked", false);
°øÀ¯Çϱâ
°øÀ¯Çϱâ
0
0
0


´ñ±ÛÀ» ºÒ·¯¿À´Â ÁßÀÔ´Ï´Ù.
¡ã ÀÌÀü±Û [PHP] ¹è¿­ ÇüŸ¦ ÆÄÀÏ·Î ¸¸µé¾î ³Ö±â ±è°æÈÆ (admin) 2016-04-21 11:18:15
¡å ´ÙÀ½±Û [javascript] document.documentMode ±è°æÈÆ (admin) 2015-10-28 13:58:57