Jump to content

Print alert if textbox has value in javascript


Recommended Posts

Hello Guys...


I have one problem in javascript guys help me i'am begginer in javascript and jquery



if user has enter value in textbox then he can't move on another screen before save the value of textbox


if user click on Add or Edit Button the alert box  print message 'Save the Value' it's ok .


but when i click on Save button, i don't want  alert box to save the textbox value






<script type="text/javascript">
 return check();


<script type="text/javascript">
function check() {
var txt = document.getElementById('txtbox').value;
if(txt !== '') {
    alert('Save the Value');



<input type="text" name="txtbox" id="txtbox"><br/>
<input type="submit" name="btn1" id="btn1" value="Save"><br/>
<input type="submit" name="btn2" id="btn2" value="Add"><br/>
<input type="submit" name="btn3" id="btn3" value="Edit"><br/>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.