leo
leo

Reputation: 23

jquery issue on IE

here is link to an example: http://techchorus.net/demos/jquery/hiding-input-elements-in-a-div.html It actally disables few elements on click function on radio.

It works on Firefox,but it only works on IE when you click any where on page. Why IE does not render elements in real time like firefox. Please advise.

Thanks here is the code:

<script type="text/javascript"> 
function toggleStatus() {
    if ($('#toggleElement').is(':checked')) {
        $('#elementsToOperateOn :input').attr('disabled', true);
    } else {
        $('#elementsToOperateOn :input').removeAttr('disabled');
    }   
}
</script>


    Click to change: <input id="toggleElement" type="checkbox" name="toggle" onchange="toggleStatus()" />
    </p>
    <div id="elementsToOperateOn">
        This is our example div block. <br />
        Sample Text Box: <input type="text" name="name" /> <br />
        Sample Checkbox : <input type="checkbox" name="participate" /> <br/>
        Sample Radio : <input type="radio" name="bookEarly" /> <br />
        Sample Select: <select name="sampleSelect">
                            <option>Option 1</option>
                            <option>Option 2</option>
                        </select>
    </div>

Upvotes: 2

Views: 135

Answers (1)

Gabriel Hurley
Gabriel Hurley

Reputation: 40042

My guess is that IE doesn't fire the onchange event until after the radio element loses focus. You could use the onclick event instead.

Upvotes: 2

Related Questions