troubleshooting Question

How to put Yes / No option in Javascript alert?

Avatar of meetpd
meetpdFlag for India asked on
JavaScriptASP.NET
14 Comments1 Solution872 ViewsLast Modified:
Hi,

I am checking whether a textbox has value of zero or not.

If its zero, it should display an alert asking user if they want to enter a non-zero value or not.
If user select yes, then cursor should be placed on that textbox.
If not, then it should do nothing.

My current code (see code section) displays error message but it does not have yes/no option.

How do I achieve that?


if (document.getElementById('ctl00_PageContent_txtEmployment_n0').value == '0' || document.getElementById('ctl00_PageContent_txtEmployment_n0').value == '') {
            alert('Are you sure Point 4 Tax = 0 ?  If not, please enter other value in the textbox.');
            return false;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros