Basically I have the following
$("#amount").keyup(function() {
if($(this).val() != "") {
alert($(this).closest("form").find('input[id="price"]').val());
}
});
The HTML layout is as follows
<form class="submitOrder" method="POST">
<fieldset>
<div class="form-group">
<label>Amount</label>
<input type="text" class="form-control" id="amount">
</div>
<div class="form-group">
<label>Price</label>
<input type="text" class="form-control" id="price" value="$1" disabled="">
</div>
</fieldset>
</form>
According to this statement, $(this).val()
always returns an empty value meaning the alert
won't be processed, why is this?
My exact HTML mockup within a JSFiddle : http://jsfiddle.net/7PPBq/3/