Link to home
Create AccountLog in
Avatar of Richard Lloyd
Richard Lloyd

asked on

Set the value of the min and max value of a form number field with ajax.

Please can someone advise if there is a way to update an input number field with a minimum and maximum value via an ajax call?

I have a form that is used is part of an PHP based auction website. The bidding page refreshes every 10 seconds to show the highest bid etc. The minimum value of the input needs to increased to max at least the value of the last bid.

I don't want to refresh the entire form or field as the user may have already entered a value in the form and not submitted yet.

Thank you

Avatar of Richard Lloyd
Richard Lloyd


Just found something that might work:

$('input[name="bid"]').attr('min', [enter value here via ajax. eg response.minbid])

Open in new window

Avatar of Michel Plungjan
Something like

$.get("aServerProcessReturningANumber", (data) => $('input[name="bid"]').attr('min',data));
Avatar of LegendZM
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account