JQuery input name으로 선택

by JM note

HTML

<input type='text' name='hello' value='world' />
<button id='test'>이름으로 선택 테스트</button>

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$("#test").click(function() {
  alert( $("input[name=hello]").attr("value") );
});
</script>