Skip to main content
Inspiring
October 2, 2013
Question

onkeyup

  • October 2, 2013
  • 1 reply
  • 631 views

Hi,

Why it's not working with checkbox?  If I change the type ="checkbox" to type="text" the it worked, meaning the radio button is enabled.

Thanks

<script type="text/javascript">

function EnableTextBox(sender, target, maxcar) {
    if ( sender.value.length >= maxcar )
        document.getElementById(target).disabled = false;
    else {
        document.getElementById(target).disabled = true;
        document.getElementById(target).value = '';
        }
    }

//onchange from dropbox diffrent status
function gotourl(url){ 
window.location= url; 

</script>

<cfinput type="checkbox" name="prize" id="prize" value="1" disabled="disabled" onkeyup="EnableTextBox(this, 'completed', 1);">
<cfinput type="radio" name="completed" disabled="disabled"  value="1" />

    This topic has been closed for replies.

    1 reply

    Carl Von Stetten
    Legend
    October 2, 2013

    You probably want to use onchange instead of onkeyup with checkboxes, as checkboxes have no text input to evaluate keypresses against.

    -Carl V.