I want to add 'Year' or Years' to the end of a string depending on the string. Like this:
$("#selector").val(conditional_value_here);
Using jQuery UI I have a slider that manipulates a value:
$("#slider").slider({
value: 1,
min: 1,
max: 25,
step: 1,
slide: function(event, ui) {
$("#amount").val(ui.value + ' Year' + function(){return (ui.value == 1) ? '' : 's';} );
}
});
// and again I want to do the same for the initialization of the value:
$("#amount_3").val($("#slider_3").slider("value") + ' Jahr' + function(){return ($("#slider_3").slider("value") == 1) ? '' : 's';});
This does not work. What is the correct way to to this?