问题
Im currently building a project planner form for a client, i Am using Jquery UI for a range slider.
I am struggling to figure out how to make it so that when the range value is at Max, it adds a Plus(+) to after the value in the input field.
My current script is
function projectPlannerSlider() {
$("#budgetSlider").slider({
range: "min",
min: 100,
max: 25000,
value: 7000,
slide: function (event, ui) {
$(".budget").val("\u00A3" + ui.value);
}
});
$(".budget").val("\u00A3" + $("#budgetSlider").slider("value"));
};
and my HTML is
<h3>Budget</h3>
<div id="budgetSlider"></div>
<asp:TextBox ID="budget" CssClass="budget clearStyling" runat="server" />
Any help would be very much appreciated. Cheers Jordan
回答1:
Try this:
$("#budgetSlider").slider({
range: "min",
min: 100,
max: 25000,
value: 7000,
slide: function (event, ui) {
$(".budget").val((ui.value == '25000') ? (ui.value + '+') : ui.value);
}
});
$(".budget").val($("#budgetSlider").slider("value"));
FIDDLE DEMO HERE
来源:https://stackoverflow.com/questions/16357256/jquery-ui-range-add-plus-symbol