input 변경분 표시

by JM note

HTML

<table>
  <tr>
    <td>월</td>
    <td><input class="myinput" type="text" data-orig="헬로" value="헬로"></td>
  </tr>
  <tr>
    <td>화</td>
    <td><input class="myinput" type="text" data-orig="월드" value="월드"></td>
  </tr>
  <tr>
    <td>수</td>
    <td><input class="myinput" type="text" data-orig="Hello" value="Hello"></td>
  </tr>
</table>
<button>저장하기</button>

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(".myinput").keyup(function() {
	if( $(this).val() == $(this).data("orig") ) $(this).css("background", "white");
  else $(this).css("background", "yellow");
})
</script>