hi guys im developing in my own website.every thing works fine.i want to know if i clicks the any one of the radio button that value change correspondingly.can any one please post some code i tried this below code. my website is http:spsmobile.co.uk just check the link in this page u just go to phone unlock and click make payment you will see the radio button named pay delivery methods thanks in adv
var total = parseInt($("div.total-text").text().substring(1), 10);
$("input[name='rmr']").bind('change', function () {
var amount = 0;
switch (this.value) {
case "1":
amount = 3;
break;
case "2":
amount = 5.5;
break;
case "4":
amount = 10;
break;
}
$("div.total-text").text("£" + (total + amount));
});
});
$(document)开发者_C百科.ready(function () {
$('#primary').bind('change', function () {
$.ajax({
type: "POST",
url: "include/unlock_function.php",
data: $(this).is(':checked'),
success: function (theresponse) {}
}
}
};
}
}:
I'm not sure what you are asking for, but I suggest you start using Firebug to catch errors and debug your code better. Suppose your code is complete, then you have a lot of errors (brackets..etc) I suggest using netbeans (for example) and not a notepad:
var total = parseInt($("div.total-text").text().substring(1), 10);
$("input[name='rmr']").bind('change', function () {
var amount = 0;
switch (this.value) {
case "1":
amount = 3;
break;
case "2":
amount = 5.5;
break;
case "4":
amount = 10;
break;
}
$("div.total-text").text("£" + (total + amount));
});
$(document).ready(function () {
$('#primary').bind('change', function () {
$.ajax({
type: "POST",
url: "include/unlock_function.php",
data: $(this).is(':checked'),
success: function (theresponse) {}
});
});
});
Example for the rmr radio.
精彩评论