I'm currently trying to find a way to fill the max value of an input according to the
max="@value"
Currently I'm using asp.net mvc, I'm getting data from a datatable and I render this information inside a html table where in my tr> /tr> I have a td> /td> that looks like this
<td align="center"><input type="number" name="txtID" class="txtID" oninput="setValueAttr(this)" min="0" max="@monto.Trim()" value="" step="any" style="width: 100px" /></td>1
Can anyone tell me how to make a javascript function that automatically fills the max="" value inside a Html TableRow?
The problem is that each row has its unique max @value
element.maxif it's in an event handler then you could probably useevent.currentTarget.maxand so ononinput="setValueAttr(this)"withonclick="this.value=max".oninput="setValueAttr(this)"on another script where I push into an array the rows that do have a value in the input in order to post it with AJAXfunction setValueAttr(el) {el.setAttribute('value', el.value)}<td>catch the event handler?onclickis not the same asoninput. So if you want to react on click, like the title suggests, useonclick.