In code there is javascript part where test the user input if negative number it will disable sumbit button. Now the problem is that I cant get to reset to normal once the fix the number to positive number. Here is what I have try
if num< 0
Do something in here
disable = true .
Return true
disable = false.

It won't work both when I put it like that I have try a while loop also does work.

Recommended Answers

All 2 Replies

You have a return statement before other code you want to run.
Code after a return statement gets skipped because the return state redirected back to wherever it was called from immediately.
If you have:

return true;
disable = false;  // this line never gets read

You haven't posted up actual code however but if this mimics your live code I'd say that is your problem.

You can use <input type="number" min="0" /> instead of disable submit button in HTML5.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.