0

have a page that displays a list of records. The user can select the amount status using radio buttons,

If(isset($_POST['rmr'])) {

//$addtocart = $_POST['rmr'];// ?>
    input type="radio" name="rmr"  id="payment1" value="30" onclick="updatepayment(this.value)" 
    input type="radio" name="rmr"  id="payment2" value="55" onclick="updatepayment(this.value)" 
    input type="radio" name="rmr"  id="payment4" value="100" onclick="updatepayment(this.value)" 

after that i used the below query

$(document).ready(  
    function()  {
        // find the checked input and store it as "currChecked" for the record
        $("#finalpayment").data("currChecked", 
                             $(this).find("input:radio:checked")[0]);
        // add the click event
        $("#finalpayment").click( function(event) {
                 if ($(event.target).is("input:radio") && 
                     event.target !== $(this).data("currChecked")) 
                 {
                    $(this).data("currChecked", event.target);
                    handleChangeEvent(event);
                 }
            });

        });
    }
);

update payment(currentvalue)
{
    document.getElementById("finalamount").innerHTML=(document.getElementById("totalamount").value*currentvalue);
}

what i actually want when user clicks the button that value should display on the browser but result is null can any one tell the problem else which code i have to follow. have a nice day

1
  • Where is the handleChangeEvent function and what type of element is is finalpayment Commented Jan 3, 2011 at 10:32

1 Answer 1

1

what i actually want when user clicks the button that value should display on the browser but result is null can any one tell the problem else which code i have to follow. have a nice day

Could you not just use the :checked pseudo class, put a click event on the radio buttons themselves instead of inlining them in the tags?
Example:

$(document).ready(function(){

$("input[name=rmr]").click(function()
{
    if( $("input[name=rmr]:checked").length > 0 ) //make sure one is checked
    {
        $("#finalamount").html( $("#totalamount").val() * $("input[name=rmr]:checked").val() );
    }
});

});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.