유령노트
id 미사용 form 데이터 유효성 검사 본문
1
2
3
4
5
6
7
8
9
|
<form name="roomForm" method="post" onsubmit="return dataCheck(this);" action="" >
<input type="hidden" name="hiddenBox" value="hiddenBox" />
<select name="selectBox">
<option value="1">option1</option>
<option value="2">option2</option>
</select>
<input type="text" name="textBox" value="textBox"/>
<input type="submit" value="확인">
</form>
|
cs |
1
2
3
4
5
6
|
function dataCheck(formData)
{
$.each(formData, function(index, elem){
alert("targetName : " + $(this).attr("name") + ", targetID : " + $(this).attr("id") + ", targetType : " + $(this).attr("type") + ", targetValue : " + $(this).val());
});
}
|
cs |
'# Dev > Javascript' 카테고리의 다른 글
파일 체크 스크립트 (0) | 2020.09.24 |
---|---|
JS에서 EXCEL -> CSV 변환 및 다운로드 기능 (0) | 2020.09.24 |
함수 속도 체크 (0) | 2018.04.03 |
window.location, URL에서 값 가져오기 (0) | 2017.10.17 |
제이쿼리 사용 안하기 (0) | 2017.09.28 |