最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I add (+-) Button Number Incrementers to this Code - Stack Overflow

programmeradmin0浏览0评论

I hope y'all are good!

Can you help me to make this quantity picker from Dropdown to be like this one with - and + buttons:

I want to do this feature on this code:

<div style="" class="fields">
 <div class="options">
  <span class="text">Quantity</span><p>:</P>
   <select id="quantityF" name="entry" placeholder="Quantity" required>
     <option style="font-size:12px" value="1" selected disabled hidden>1</option>            
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
   </select>
 </div>
</div>

Thank you so much guys in advance for your help!

I hope y'all are good!

Can you help me to make this quantity picker from Dropdown to be like this one with - and + buttons:

I want to do this feature on this code:

<div style="" class="fields">
 <div class="options">
  <span class="text">Quantity</span><p>:</P>
   <select id="quantityF" name="entry" placeholder="Quantity" required>
     <option style="font-size:12px" value="1" selected disabled hidden>1</option>            
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
   </select>
 </div>
</div>

Thank you so much guys in advance for your help!

Share Improve this question asked May 24, 2020 at 3:00 JamesJames 1721 gold badge1 silver badge14 bronze badges 2
  • 2 So do you want a dropdown or an input field? – kmoser Commented May 24, 2020 at 3:25
  • @kmoser I want quantity picker like the one in the image I've attached with question above, if you have example about input field to see if it can do the job I want or no – James Commented May 24, 2020 at 5:48
Add a ment  | 

1 Answer 1

Reset to default 2

I think you're looking for an <input type="number">, not a <select>. There's a w3schools example here.

It's possible to style the increment/decrement buttons. I suggest referring to this Stack Overflow question

发布评论

评论列表(0)

  1. 暂无评论