views:

18

answers:

1

Hello guys,

I am having a small problem with pushing a value into a input text field and have it pass on to the next step upon submitting a form in IE.

This process works just fine in FF and Chrome and pretty much every other browser.

Here is the input field:

<div id="donate_form_gift">
                    <fieldset id="donate_form_gift_amount_fieldset">
                    <!-- TODO: Update with the correct LEVEL_IDs for your FORM -->
                    <div style="clear: both; margin-top: 5px; color:#000;">
                        <input type="radio" value="9705" id="level_other" name="level_id" style="display:inline; margin-top:5px;" checked="checked" />
                        <!-- TODO: update value -->
                        <input type="text" id="other_amount" size="10" name="other_amount" value="" checked="checked" />
                    </div>
                    </fieldset>
                 </div> <!-- /donate_form_gift -->

What I need to happen is pass to the text input field an amount of donation. Here is the script behind that, which is working just fine in FF and other browsers:

function change(id)
{
var i=findpos(id);

totalprice+=(parseInt($('#'+id+'_cnt').val())-purchased[i].cnt)*purchased[i].price;

purchased[i].cnt=parseInt($('#'+id+'_cnt').val());
update_total();
}

function update_total()
{
if(totalprice)
{
    $('#total').html(totalprice);
    $("input:text:checked").val(totalprice);
    $("input:text:checked").html(totalprice);
}
else
{
    $('#total').html('');
}
}

I don't know why this is not working in IE...

Thanks,

Any help would do.

Matt

A: 

I'm guessing that IE does not respect the :checked selector on a text input. Use a class selector instead.

<!-- in the form -->
<input type="text" ... class="checked" />

// and the javascript
$("input.checked:text").val(totalprice);
$("input.checked:text").html(totalprice)
Joel Potter
Joel... I will try that thanks!
Matthew
It worked just fine! thanks Joel!
Matthew