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)
I'm trying to change durationPlan
as "per month" if the price is 29 & "per year" if the price is 261.
But I'm unable to change that. Please help, I'm new to jQuery.
The Working Corrected Code is
if (price == "29") {
$('p#durSubsMY')[0].innerHTML = "per month"
}
if (price == "261" ){
$('p#durSubsMY')[0].innerHTML = "per year"
}
Thanks everybody for your help !!!
Cheers ! :-)