find if span is string or numeric

151
December 14, 2017, at 02:38 AM

Learning my way though this one step at a time. I need to have both divs not show if price is less 399, I need the monthly div to show if above and I need the possible div to show if not numeric. Currently I'm struggling to tell if a price is actually given or if it says out of stock, get a quote etc...

I'm sure my code isn't the cleanest but any help would be appreciated.

jQuery(function($) {
const price = document.getElementsByClassName('price-value')[1].innerHTML;  // Price of item 

let totalPrice = Math.ceil(Number(price.replace(/[^0-9\.-]+/g,"")) / 12);
let totalPrice = Math.round((Number(price.replace(/[^0-9\.-]+/g,"")) / 12)* 100)/100;

var num = '$' + totalPrice.toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
var pricecheck = $('span.price-value:eq(1)'),
    priceValue = Number(pricecheck.text().replace(/[^0-9\.]+/g,"")),
    priceLimit = 399,
    shipping = $("#monthly");   
possible = $("#possible");
 if (isNaN(priceValue)){
possible.show();
shipping.hide();
}
else if (priceValue < priceLimit) {
    shipping.hide();
possible.hide();
}else{
document.getElementById("month-payments").innerHTML = num += ' a Month';
possible.hide();

}
});;</script>
READ ALSO
execute function after Fullcalender eventAfterAllRender

execute function after Fullcalender eventAfterAllRender

I want to execute a function after I have given the Fullcalender a new source and it has rerenderedThere is a way to manipulate the calender dynamically

183
Jquery data table filtering not working when comma is used

Jquery data table filtering not working when comma is used

I have a data table and I am trying to filter the rows using a filter string which has comma in it

121
Autocomplete, jQuery and NuGet

Autocomplete, jQuery and NuGet

I have a similar question to the one on this pageWhen I followed the instructions to use the NuGet option, I received this error:

175
jQuery - Quiz results based on correct answers

jQuery - Quiz results based on correct answers

I'm trying to make this simple quiz to work the way I would like but can't figure it out since I'm not into coding too much

74