Вы можете сделать это:
jQuery.fn.extend({
textOnly: function() {
// make a clone of this object so we are not changing the actual DOM
var obj = $(this).clone();
// remove all the children, i.e. any DOM objects
obj.children().remove();
// get the text value after all DOM elements are removed
return obj.text();
}
});
тогда вы можете назвать это так
var price = $(".price").textOnly();
вы получите желаемое значение.