Javascript and html input
Posted: Sun Jun 18, 2006 9:56 am
I am using the following input for a numerical value which is the quantity of items to be purchased. This value is then used to create the total price.
The problem is, how do I update the value and have javascript detect the onChange.
i.e. I have an existing quantity of 5 and I want to increase it to 7. I then want the total price to increase to reflect the change. This is all done without having to click on an update button.
Using javascript onChange only works when the input 'box' no longer has focus.
I have used the html select and option field. This works OK with javascript onChange, but is limited to the number of values you make selectable within the options field. I would like the client to select the value.
Do I need to start looking at an onload function to continually monitor input to this field. Or is it possible to engineer the focus of the input field so that it will fire on value change?
Thanks for any advice in advance.
Code: Select all
echo "<input id='myQty' type='text' name='qty' value='".$qty."' />";i.e. I have an existing quantity of 5 and I want to increase it to 7. I then want the total price to increase to reflect the change. This is all done without having to click on an update button.
Using javascript onChange only works when the input 'box' no longer has focus.
I have used the html select and option field. This works OK with javascript onChange, but is limited to the number of values you make selectable within the options field. I would like the client to select the value.
Do I need to start looking at an onload function to continually monitor input to this field. Or is it possible to engineer the focus of the input field so that it will fire on value change?
Thanks for any advice in advance.