jQuery parsing html into JSON
I am currently using the following code:
jQuery('#book-a-service').click(function(){
var selectedServices = jQuery('.selected').parent().parent().html();
console.log(selectedServices);
});
and that returns:
<td rowspan="3">Brakes</td>
<td class="service-title">BRAKES SET</td>
<td class="service-description"><p>Setting of front and rear brakes for
proper functioning (excluding bleeding)</p></td>
<td class="service-price">R <span id="price-brakes-set">R75</span><div
id="select-brakes-set" class="select-service selected"></div>
</td>
which is what i want, except i need an array of all the elements with
'.selected' class in JSON.. i just want to know how i could almost parse
it in a way that i only get the contents of the td tags and as for the
"service-price" only the numeric value and then how would i insert those
values into a json object?
Any Help Greatly Appreciated..
No comments:
Post a Comment