I have a input field like below,
<input name="update_price" type="text" id="update_price" value="£" size="8"
maxlength="8" />
I’d like to get some price value from the value of a select box and add it after the £ sign, how is this achieved in jquery,
<form>
<select name="select" id="select">
<option>Select your pizza</option>
<option value="6.65">NY, 10", £6.65</option>
<option value="8.95">NY, 12", £8.95</option>
<option value="11.95">NY, 16", £11.95</option>
<option value="3.45">Chicago, 7", £3.45</option>
<option value="6.65">Chicago, 10", £6.65</option>
<option value="8.95">Chicago, 12", £8.95</option>
<option value="11.95">Chicago, 16", £11.95</option>
<option value="19.95">Chicago, Beast 24" x 18", £19.95</option>
</select>
</form>
$(function()
{
$('#select').change( function() {
$('input[name=update_price]').val($("#select :selected").val() );
});
});
it works with the code above but the £ sign disappears, any help would be appreciated.
In the past I have used a background image on the input box for the currency symbol. That way the symbol can look pretty, be left aligned (while the value is right aligned) and it doesn’t get in the way of calculations.
Hope that helps