JAVASCRIPT
JAVASCRIPT TEXTAREA 포커스 맨끝으로 보내기
영은파더♥
2016. 8. 11. 09:29
728x90
JAVASCRIPT TEXTAREA 포커스 맨끝으로 보내기
아래 처럼 하면 텍스트 내용이 많아서 스크롤이 생기더라도 FOCUS를 제일 끝으로 보낼 수가 있다.
<!DOCTYPE html>
<html>
<head>
<script>
function action_focus() {
var tmp = document.all.memo.value;
document.all.memo.value = ''; document.all.memo.value = tmp;
document.all.memo.focus();
}
</script>
</head>
<body>
<textarea id="memo" style="width:300px;height:150px;">
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
1234
</textarea>
<button onclick="action_focus();">포커스</button>
</body>
</html>
728x90
반응형