jQuery/Javascript problem with IE
        Posted  
        
            by Shadyn
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Shadyn
        
        
        
        Published on 2010-04-12T14:44:54Z
        Indexed on 
            2010/04/12
            14:52 UTC
        
        
        Read the original article
        Hit count: 202
        
I have two radio buttons each with a unique ID. When one is clicked, I would like to add $10 to a total. When the other is clicked, we go back to the original total price. My jquery looks like this:
function check_ceu() {
    var price = <%= conference_price %>;
    if($('#ceu_yes').is(':checked')){
            $('#total').val(parseFloat(price) + 10)
        }
        else{
            $('#total').val(price)
        }       
}
I have this function bound to document.ready (for page refreshes) and also the onchange handler of the radio buttons.
In FF and Chrome this works fine. In IE, when the radio button with ID of "ceu_yes" is checked nothing happens, then when clicking back to the other radio button, 10 is added. So in essence, IE has the checkbox functionality reversed. Below is my code for the buttons:
<input type="radio" name="ceu" id="ceu_yes" value="1" onchange="check_ceu()" /> $10
<input type="radio" name="ceu" id="ceu_no" value="0" checked="checked" onchange="check_ceu()" /> No, thank you
Any ideas on this?
© Stack Overflow or respective owner