0

want to get <span class="price">Rs.5,190.00</span> using jquery, below is html

<div id="checkout-review" class="onepagecheckout_block">
      <div class="op_block_title"><i class="fa fa-shopping-cart"></i>Review YourOrder</div>
      <div id="checkout-review-load" class="" style="width: auto; height: auto;">
         <div id="checkout-review-table-wrapper">
           <tr class="first">
              <td style="" class="a-right" colspan="2">Subtotal</td>
              <td style="" class="a-right last"><span class="price">Rs.5,190.00</span></td>
           </tr>
         </div>
      <div>
16
  • paste your html . Oct 13, 2018 at 18:37
  • <tr class="first"> <td style="" class="a-right" colspan="2"> Subtotal </td> <td style="" class="a-right last"> <span class="price">Rs. 5,190.00</span> </td> </tr>
    – sdf
    Oct 13, 2018 at 18:39
  • <div id="checkout-review" class="onepagecheckout_block"> <div class="op_block_title"><i class="fa fa-shopping-cart"></i>Review YourOrder</div> <div id="checkout-review-load" class="" style="width: auto; height: auto;"><div id="checkout-review-table-wrapper"> <tr class="first"> <td style="" class="a-right" colspan="2"> Subtotal</td> <td style="" class="a-right last"> <span class="price">Rs. 5,190.00</span></td> </tr> </div> <div>
    – sdf
    Oct 13, 2018 at 18:39
  • now what you want to get ? Oct 13, 2018 at 18:40
  • <span class="price">Rs. 5,190.00</span> this one
    – sdf
    Oct 13, 2018 at 18:41

1 Answer 1

0

try -

to get this <span class="price">Rs.5,190.00</span>

use jQuery('#checkout-review-table-wrapper').find('span.price');

to get this Rs. 5,190.00

use jQuery('#checkout-review-table-wrapper').find('span.price').text();

to get price only like this 5,190.00

use var price = jQuery('#checkout-review-table-wrapper').find('span.price').text();
price = price.replace( /^\D+/g, '');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.