본문 바로가기
코딩

placeholder 스크립트

by euntori 2014. 10. 2.
반응형

input에 value값준거 텍스트 클릭시 없애기

<input type="text" onfocus="this.value=''; return true" value="내용" />

 

또는

focus 됐을 때, value값을 빈값으로 넣고, value가 처음과 다른 값이면 그대로 두기.

<input onblur="if(this.value == '') this.value='이름'" onfocus="if(this.value == '이름') this.value=''" type="text" value="이름">

 

반응형

Designed by 티스토리