How to add Suffix text in JQuery Spinner

后端 未结 5 616
旧时难觅i
旧时难觅i 2020-12-20 04:14

Is it possible to add suffix into jQuery spinner (jquery.ui.spinner). e.g: 10.02%.

I tried following, from jquery.ui.spinner [under Option section], but it did not w

5条回答
  •  囚心锁ツ
    2020-12-20 04:51

    I'd consider adding an additional input showing a text with suffix, while the spinner is containing only number. That is a convenient way to work with posted data.

    $( ".spinner" ).spinner({ 
        min: 1,
        max: 999,
        spin: function() {
            $(this).siblings('.spinner-text').val($(this).val()+' items');
        },
        stop: function() {
            $(this).siblings('.spinner-text').val($(this).val()+' items');
        }
     }).parent().append('');
    

    http://jsfiddle.net/6t9bS/3/

提交回复
热议问题