var user;
(function (user) {
user = {
dynamicPriceChange: function () {
$("input[name='user[plan_id]']").change(function (e) {
var planId = $(this).data('text');
var durationPlan = $('p#durSubsMY')[0].innerHTML;
var price = $('.price')[0].innerHTML;
$('.price').text(planId);
$('span#Love')[0].innerHTML = price;
if price == "29" {
durationPlan = "per month";
}
if price == "261" {
durationPlan = "per year";
}
});
}
jQuery(function () {
user.dynamicPriceChange();
});
})(user)
如果价格为 29,我尝试更改durationPlan
为“每月”,如果价格为 261,我尝试更改为“每年”
。但我无法更改。请帮忙,我是 jQuery 新手。
工作更正的代码是
if (price == "29") {
$('p#durSubsMY')[0].innerHTML = "per month"
}
if (price == "261" ){
$('p#durSubsMY')[0].innerHTML = "per year"
}
谢谢大家的帮助!!!
干杯!:-)