テキスト入力フィールドの入力有無チェック

テキストフィールド内に文字列が入力されているかいないかをチェック。


サンプルコード

	<script type="text/javascript">
		function check_isnull(){
			if(document.getElementById("text_isnull").value == ""){
				alert("入力されていません");
			}else{
				alert("入力されています");
			}
		}
	</script>

	<input type="text" name="text_isnull" id="text_isnull" value="" size="40" />
	<input type="button" value="チェック" onclick="check_isnull()" />

コメントを残す

メールアドレスが公開されることはありません。