Reputation: 705
I have a class that has the value of total
<span class="price-value">0</span>
and a class of a radio button
class="radio-livraison element-radio-input" disabled="disabled"
is is possible to disable the radio button and enable it only if total is more than 28; example you can't check the radio button if span price-value is less than 28
<script>
if ($('.ezfc-price-value') > 24){
$('.ly-radio-livraison').removeAttr("disabled");
}
</script>
but I get error:
Uncaught TypeError: $ is not a function
I have jQuery and Bootstrap on my template before the code.
Upvotes: 0
Views: 63
Reputation: 2664
demo: http://jsbin.com/toguruzure/1/edit?html,js,output
$(function(){
$(".price-value").change(function(){
$('.radio-livraison').prop("disabled", !(parseInt($('.price-value').text()) > 28));
});
$("#total").on('input', function(){
$(".price-value").text($(this).val()).change();
});
})
Upvotes: 1
Reputation: 127
Try this:
<script>
if (parseInt$('.ezfc-price-value').text()) > 24){
$('.ly-radio-livraison').prop("disabled", false);
}
</script>
You need to compare the text inside that element, not the element itself.
Hope this helps.
Upvotes: 1