I am looking for a way to \'fix\' a dollar symbol $ to a text input box eg but make it not possible for the default va
I did it like this:
$('#price').keypress(function(event) {
var code = (event.keyCode ? event.keyCode : event.which);
if ($(this).val().indexOf('$') === -1){
document.getElementById("price").value = "$" + $(this).val();
} else {
document.getElementById("price").value = $(this).val();
}
});
with .
User can remove the dollar sign manually though if he/she wants to.