1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Why is my spinbox not working?

Discussion in 'XenForo Development Discussions' started by TheBigK, May 22, 2015.

  1. TheBigK

    TheBigK Well-Known Member

    Here's what I have -

    Code:
    <input type="text" class="textCtrl number Spinbox" name="scheduleQty" value="5" min="1" step="1">
                <input type="button" class="button spinBoxButton up" value="+" data-plusminus="+" tabindex="-1">
                <input type="button" class="button spinBoxButton down" value="-" data-plusminus="-" tabindex="-1">
    
    This code shows the spinbox with + and - button; but clicking on the buttons doesn't increment / decrement the number inside the text box.

    PS: I tried to write the code referring the spinbox that appears inside the thread_create template.
     
  2. TheBigK

    TheBigK Well-Known Member

    Update: Changing input type to "number" fixed the problem. :X3:

    and those two lines for + and - were not needed. Bah!

    PS: Still don't know why does it work with input type as 'text' on the poll options on thread_create page?
     
  3. rellect

    rellect Well-Known Member

    Your first code didn't work because you wrote Spinbox instead of SpinBox (classes are case sensitive).
    When you used number type it worked because input of type number automatically gets the class SpinBox (by js).
    In additional, number inputs are automatically changed to text type in order to avoid the default browser handling of number inputs.
     

Share This Page