devidsmith Posted May 8, 2014 Share Posted May 8, 2014 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">$(document.body).click(function(){ return check();});</script> <script type="text/javascript">function check() {var txt = document.getElementById('txtbox').value;if(txt !== '') { alert('Save the Value');} }</script> <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/> Quote Link to comment https://forums.phpfreaks.com/topic/288342-print-alert-if-textbox-has-value-in-javascript/ Share on other sites More sharing options...
Maq Posted May 8, 2014 Share Posted May 8, 2014 Careful where you post, moving to JS section. Quote Link to comment https://forums.phpfreaks.com/topic/288342-print-alert-if-textbox-has-value-in-javascript/#findComment-1478778 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.