Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

Quantity button

Check this quantity button on this site:

https://d-themes.com/html/donald/product.html

I wonder how to create such button?

I only know how to create button with the following codes:

	<input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>
0 likes
12 replies
CorvS's avatar

Google "counter input [your CSS framework here]" and done.

davy_yg's avatar
Level 27

Does the button + and - button created seperately to the input box ?

Do I need javascript at all ?

CorvS's avatar

Do I need javascript at all ?

Yes

rawilk's avatar

you could just buy the theme instead of trying to rip it off

Esirei's avatar

@davy_yg Using tailwindcss and alpinejs, you can easily create this

<div x-data="{value: 1}" class="inline-flex flex-row h-12 border border-gray-500 divide-x divide-gray-500">
    <button class="w-8" @click="value--" :disabled="value === 1">-</button>
    <input type="number" min="1" class="w-16 text-center" x-model="value" />
    <button class="w-8" @click="value++">+</button>
  </div>
1 like
davy_yg's avatar
Level 27

I don't want to buy the theme, my point is I want to build onlineshop from scratch, if I can do this then I can build at least 10 different kind of online shop on my own. I modify the theme to match my needs.

rawilk's avatar

Good luck with that; considering your skill set and comprehension level, you're probably better off using something pre-made for you. Honestly, I don't think I'd trust my data with something built by you.

1 like
cmdobueno's avatar

Look @davy_yg you have spirit. But spirit isn't brain power. You might be really good at something else... maybe breathing? You should probably give this up now...

When you say "you" want to create it from scratch... what you really mean is you want the community to build it for you... the questions you are asking are below entry level man, and its been what 2 or 3 years? I am sorry, but I am not sorry. Just simply buy a template and learn from it, pay for a class, or figure out how to learn better... because you are failing.

1 like
davy_yg's avatar
Level 27

I have taken many IT classes before. It's okay if I have to take twice as long to learn as long I reach the destination eventually. Each person just have different rewards.

cmdobueno's avatar

This is not a tortoise vs the hair thing man.

Your learning process is not a process, nor is it learning. You literally post a task, and somebody in the forums who is newer thinks they are helping you... and post how to do it... you then claim that code as your own.

You have not learned a damn thing here in 2+ years...

davy_yg's avatar
Level 27

I already design and built the front end and almost done with it. I only need help with the minor things.

Please or to participate in this conversation.