question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript -> .repeaterVal() doesn't return data from fields <input type="number">

See original GitHub issue

Hi, tried to get the data form all fields in javascript using $(“.repeater”).repeaterVal(); and I found out that the doesn’t get returned by this.

Can you please check?

Example:

<form class="repeater">
    <div data-repeater-list="group-a">
      <div data-repeater-item>
        <input type="text" name="text-input" value="A"/>
        <input type="number" name="number-input" value="1"/>
        <input data-repeater-delete type="button" value="Delete"/>
      </div>
    </div>
    <input data-repeater-create type="button" value="Add"/>
    <input type="button" value="Check data" onclick="checkData()" />
</form>

<script src="path/to/jquery.js"></script>
<script src="path/to/jquery.repeater/jquery.repeater.js"></script>
<script>
    $(document).ready(function () {
        $('.repeater').repeater();
        
        function checkData(){
          let data = $(".repeater").repeaterVal();
          console.log(data);
        }
    });
</script>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
jeni1616commented, Jul 16, 2020

If anyone is facing same issue, download whole repeater files, in that you should find jquery.input.js file, replace it with this one: https://pastebin.com/ezrQ412T

It supports date and number both, I created date code from this trick: https://github.com/DubFriend/jquery.repeater/pull/94/commits/8c709d074ed5f0ad4463a51fec51e785f6dbd299

Make sure to include lib.js file as well. download whole repeater files and you should see this file in src folder.

2reactions
RubenMartinscommented, Aug 6, 2018

@ahazeemi check this PR with add support for input type=“number” https://github.com/DubFriend/jquery.repeater/pull/94

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input type number does not return value when having ...
I have tried to use type="tel" , but it does not show dot comma values. Then decide to use type="number", its allows all...
Read more >
How to force Input field to enter numbers only using JavaScript
Now forcing input field type=”text” to accept numeric values only by using Javascript or jQuery. You can also set type=”tel” attribute in the ......
Read more >
<input type="time"> - HTML: HyperText Markup Language | MDN
A Boolean attribute which, if present, means this field cannot be edited by the user. Its value can, however, still be changed by...
Read more >
HTML Input Types - W3Schools
<input type="text"> defines a single-line text input field: ... If you omit the submit button's value attribute, the button will get a default...
Read more >
How to Allow Only Positive Numbers in the Input Number Type
Solutions with HTML attributes. As we know, the <input type="number"> specifies a field for entering a number. If you want to restrict the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found