jQuery allow only number or decimal point or percentage sign

i just want to allow value like below to pass:

18 12.5% 13%

not allowing any other like: 12ad aa21

if( /[0-9\.]+%?/.test( shop_price ) == true){      
    $("#shop_price_label").html("Please enter number or number % only")
    event.preventDefault();

but its not working with the above code. can anyone help me with this?

Answers 1

Related Articles