Reputation: 279
I wrote a program to change the value of a field when the user type a value in text-boxes. In my case the 2 text-boxes are height and width. When someone enter a height and width relevant price should be shown. I'll put my coding down below.
<div class="form-group">
<div class="col-sm-9">
<input type="text" id="height" />
<input type="text" id="width" />
<button type="button" id="show">Enter Size</button>
<button type="button" id="hide">Hide</button>
<script> jQuery('height').on('input', function() {
<?php echo "hello" ?>
});
function()
{
<input id="post_price" type="hidden" name="price" value="<?=$price['price'];?>">
}
</script>
</div>
</div>
I'm not exactly sure the way I did. There are no output results at the moment. Could someone help me? To make more sense I'll attach a screenshot of my form. Thanks!
Upvotes: 2
Views: 122
Reputation: 2458
You could use keydown
or keypress
event.
I made a little exemple here
Upvotes: 1