javascript - Empty field check -
i have flowing code working fine need check empty field, , if field empty show message , not go new page. keep trying add code crashes help
find
<script>     function gotourl(){         var newurl = document.gotoform.theurl.value         document.location.href="http://www.bluediamond.tv/jobs/" + newurl     } </script>  </head>  <body>     <form action="javascript:gotourl()" method="get" name="gotoform">         <p align="center"><input maxlength="100" name="theurl" size="20" type=“find” value="" align="middle" /></p>         <p align="center"><input type="submit" value="view photographs" /></p>     </form>  </body> 
okay, first add inside input's tag
class="myinput" then update function
function gotourl(){         if($('.myinput').val() == ""){                 alert('please fill field');         }else{                 var newurl = $('.myinput').val();                 document.location.href="http://www.bluediamond.tv/jobs/" + newurl;         } } 
Comments
Post a Comment