TIL #06 HTML button, hidden

JohnKim·2021년 4월 7일
0

HTML

목록 보기
5/8
post-thumbnail

button

<form action="http://localhost/form.php">
        <input type="text">
        <input type="submit" value="전송"> 제출할 때 사용하는 버튼 value값을 사용해 내용을 변경한다.
        <input type="button" value="버튼" onclick="alert('hello world')"> 
        전송버튼은 페이지가 바뀌지만  button은 바뀌지 않는다. 보통 자바스크립트를 사용할때 쓴다.
        <input type="reset">
        재설정하는 버튼이다. 사용자가 정보를 입력한 후 reset버튼을 누르면 모든 정보가 초기화 된다.
    </form>

hidden

ui가 필요없거나 몰래 서버쪽으로 데이터를 전송해야 할 경우 hidden field 라는것을 사용한다.

 <form action="http://localhost/hidden.php">
            <input type="text" name="id">
            <input type="hidden" name="hide" value="egoing">
            <input type="submit">
        </form>
        
        제출 버튼을 누르게되면 id 라는 이름의 값뿐만아니라 사용자는 보이지 않지만 hide라는 이름의 egoing이라는 값이 같이 ui로 전달된다.

0개의 댓글