Reputation: 10685
I have a strange problem. When I click on my form's 'TransDesc' input text element, focus goes immediately to the first element, 'Quantity'. I believe it has something to do with my onchange for the 'Amount' element.
In order to get focus in 'TransDesc', I have to tab past 'Quantity' and then 'Amount'.
I tried a set focus in retTotalAmt(), but that did not work.
What do I need to change, so I can click on TransDesc, and not have the focus return to 'Quantity'
function retTotalAmt()
{
var total_amt =
document.forms["InvGenPayTickets"]["Quantity"].value * ticketCost;
document.getElementById('Amount').value = total_amt.toFixed(2);
}
.
.
.
Quantity
<input type='text' name='Quantity' id='Quantity'
onchange="return retTotalAmt();" />
Amount
$<input type='text' name='Amount' id='Amount' readonly="readonly" />
<input type=text name="TransDesc" id="TransDesc" maxlength=255 />
There are elements surrounding some of the form fields.
Upvotes: 3
Views: 191
Reputation: 6030
So I think there is a problem with <label>
elements surrounding input fields, probably there are confusing IDs like in this example:
<label for="input1"><input id="input1" /></label>
<label for="input1"><input id="input2" /></label>
so if you don't need that labels, just remove them or try to fix the IDs
Upvotes: 2