Skip to content

How to pass an extra parameter to the decrement and increment button? #129

@Brecht272727

Description

@Brecht272727

I use your input-spinner in a cart with different items. But i need to know how i can pass a parameter like data-id=... to the buttons.
After that i am able to decrease or increase the quantity of that specific product in the cart.
I am using the template in the props.

				var props = {
						autoDelay: 500, // ms threshold before auto value change
						autoInterval: 50, // speed of auto value change, set to `undefined` to disable auto-change
						buttonsOnly: true, // set this `true` to disable the possibility to enter or paste the number via keyboard
						keyboardStepping: true, // set this to `false` to disallow the use of the up and down arrow keys to step
						template: // the template of the input
								'<div class="input-group ${groupClass}">' +
								'<button style="min-width: ${buttonsWidth}" class="btn btn-decrement ${buttonsClass} btn-minus" type="button">${decrementButton}</button>' +
								'<input type="text" inputmode="decimal" style="text-align: ${textAlign}; box-shadow: none; width: 20% !important;" class=""/>' +
								'<button style="min-width: ${buttonsWidth}" class="btn btn-increment ${buttonsClass} btn-plus" type="button">${incrementButton}</button>' +
								'</div>'				
				};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions