본문 바로가기

Web/Java Script

그냥 체크..

function checkComment(obj) {
 var comment_val = obj.comment_Content.value;
   if (comment_val == "") {
      alert("내용을 입력해 주세요!!");
        f.comment_Content.focus();
        return;
   } else {
 $(obj).attr("action", "comment_write.do").submit();
   }
}

 

 

<form name="f" method="post">
             <input type="hidden" id="board_Num" name="board_Num"
              value="${dto.num}">
               <input class="w3-input" type="text" name="id">
              <input class="w3-input" type="password" name="passwd">
              
              <input class="w3-input" type="text" name="comment_Content">

             <input type="button" value="작성" onclick="checkComment(this.form)">

</form>