DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
388 stars 191 forks source link

Input type number does not support #158

Closed bishwajitcadhikary closed 1 year ago

bishwajitcadhikary commented 2 years ago

<input type="number" name="money"/> does not return value

pravnkay commented 1 year ago

For this to work,

You can set the type to text and also have a data attribute on your number input fields like, data-convert marking them to be converted to number type.

<input type="text" data-input="convert" />

Once the repeater is initialized, under the show property you can convert them all back to number type like,

$('.repeater').repeater({
  initEmpty: true,
  show: function () {
    // changing the manual input fields of number type to number type from text
    repeater.find('input[data-input="convert"]').removeAttr('type').attr('type',"number")

    //continue...

At least, that's how I do it for now.