Jquery and gettin data from radio input.
Im still learning the basics of Jquery, so bare with me! I'am trying to create a cart with jquery. This cart is for a computer builder.
At this point, a user can select parts they want and the price gets updated through jquery at the bottom of the page instantly.
Here is the code that I made up to accomplish this:
-
var total = 0;
$('input:radio:checked').each( function () {
total = total + Number(this.value)
});
$(".total").empty();
$(".total").append(total);
$('input:radio').click(function(){
total=0;
$('input:radio:checked').each( function () {
total = total + Number(this.value)
});
$(".total").empty();
$(".total").append(total);
});
My question is, since I added text="xxx" to the radio input.
(<input type=radio ... value="xxx" text="xxx">), how do I access this data?
I thought this.text would do the trick since this.value worked for grabbin the price out, but no cigar!
Any pointers here?