ksumanth Posted March 15, 2013 Share Posted March 15, 2013 Hello everyone, I have a form, In that i have two textboxes 1. Total amount 2. Paid amount if second textbox value is greater than first textbox then i should display alert and the textbox should empty using javascript or jquery. can any one help me Thanks Sumanth Quote Link to comment https://forums.phpfreaks.com/topic/275688-second-textbox-value-is-greater-than-first-textbox-display-alert-using-javascript/ Share on other sites More sharing options...
denno020 Posted March 15, 2013 Share Posted March 15, 2013 Just so you know, jQuery is javascript, just written in a nice way. you'll basically want to grab the values for the two text boxes, similar to this (using jQuery): var firstBox = $('#first_text_box').val() var secondBox = $('#second_text_box').val() Then you'll use a simple if statement to compare the values, and perform some action (alert) if the second is greater than the first if(secondBox > firstBox){ alert("Some message"); } Hopefully that'll get you started. Denno Quote Link to comment https://forums.phpfreaks.com/topic/275688-second-textbox-value-is-greater-than-first-textbox-display-alert-using-javascript/#findComment-1418786 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.