I am trying to have my dynamically generated text inputs only allow for digits and an optional decimal point in between. I am using the attribute but the inputs are still unresponsive to the RegEx.
var howMuch = $("<input>").attr("type", "text").attr("name", "howMuch").attr("pattern", "([0-9]+(\.[0-9]+)?)").prop("required", true);
The HTML generates like so: HTML
PLEASE do not mark this question as duplicate, none of the existing similar answers are already using the 'required' attribute
"([0-9]+(\\.[0-9]+)?)"to account for string metacharacter interpretation."([0-9]+(\.[0-9]+)?)"is exactly the same as"([0-9]+(.[0-9]+)?)".