ÃֽŠ°Ô½Ã±Û(WEB)
2020.01.28 / 24:43

jQuery ¹öÆ° ÅؽºÆ® º¯°æ

±îÄ¡¼³³¯
Ãßõ ¼ö 243
jQuery ¹öÆ° ÅؽºÆ® º¯°æ
jQuery ¹öÆ° ÅؽºÆ® ¹Ù²Ù±â

1 ¹æ¹ý: button ű״ html()[ÆíÁý]

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(function() {
  $('#button1').click( function() {
    if( $(this).html() == 'Á¢±â' ) {
      $(this).html('ÆîÄ¡±â');
    }
    else {
      $(this).html('Á¢±â');
    }
  });
});
</script>
 
<button id='button1'>Á¢±â</button>

2 ¹æ¹ý: input ű״ val()[ÆíÁý]

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(function() {
  $('#button1').click( function() {
    if( $(this).val() == 'Á¢±â' ) {
      $(this).val('ÆîÄ¡±â');
    }
    else {
      $(this).val('Á¢±â');
    }
  });
});
</script>
 
<input type='button' value='Á¢±â' id='button1' />

3 °°ÀÌ º¸±â[ÆíÁý]

4 Âü°í[ÆíÁý]