Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
86
rated 0 times [  92] [ 6]  / answers: 1 / hits: 159464  / 13 Years ago, tue, december 6, 2011, 12:00:00

I can easily disable a javascript button, and it works properly. My issue is that when I try to re-enable that button, it does not re-enable. Here's what I'm doing:



<script type=text/javascript>
function startCombine(startButton) {

startButton.disabled = 'true';

startButton.disabled = 'false';

}
</script>
<input type='button' id='start' value='Combine Selected Videos'
onclick='startCombine(this);'>


Why isn't this working, and what can I do to make it work?


More From » html

 Answers
45

true and false are not meant to be strings in this context.



You want the literal true and false Boolean values.



startButton.disabled = true;

startButton.disabled = false;


The reason it sort of works (disables the element) is because a non empty string is truthy. So assigning 'false' to the disabled property has the same effect of setting it to true.


[#88734] Sunday, December 4, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
casandra

Total Points: 334
Total Questions: 93
Total Answers: 104

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
;