如何在jQuery.knob中添加值后缀 [英] How to add a value suffix in jQuery.knob

查看:216
本文介绍了如何在jQuery.knob中添加值后缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 jQuery.knob 上遇到问题 我需要在旋钮的值上添加 Sufixx .

例如:我需要在值后添加一个Sufix $ ,我只是将其放在value字段中,显示它,但是那时旋钮将不显示状态.

它不会显示旋钮状态. (但显示后缀).

下面是代码:

<input type="text" class="ksta" value="<?php echo stat;?> $" data-width="50" />

没有后缀即可正常运行,请帮助我解决此问题.

我的问题的Jsfiddle链接:

http://jsfiddle.net/renishar/DWvsh/19/

在jsfiddle中,它可以在没有 $ 符号的情况下工作,但不能与 $ 登录值一起工作.

( $ 符号可以是任何值或符号)

解决方案

尝试简单的方法,

jQuery(document).ready(function($){
        $('.ksta').knob({
            'min':0,
            'max':100,
            'step': 1,
            'displayPrevious': true,
            'readOnly': true,
            'draw' : function () { $(this.i).val(this.cv + '%'); }
        });
    });

无需更改样式和其他详细信息.....

演示: http://jsfiddle.net/renishar/DWvsh/20/

I have problem with jQuery.knob I need to add a Sufixx to the value in the knob.

For Example: i need a Sufix $ after the value, i just put in the value field, its displaying, but at that time the knob will not show the status.

it will not show the knob status. (but suffix is displaying).

here is the code:

<input type="text" class="ksta" value="<?php echo stat;?> $" data-width="50" />

without the suffix it working perfectly, help me to solve this issue.

Jsfiddle link for my issue:

http://jsfiddle.net/renishar/DWvsh/19/

in the jsfiddle it work without the $ sign, but not working with $ sign in value.

($ sign may be any value or symbol)

解决方案

Try this in a simple way,

jQuery(document).ready(function($){
        $('.ksta').knob({
            'min':0,
            'max':100,
            'step': 1,
            'displayPrevious': true,
            'readOnly': true,
            'draw' : function () { $(this.i).val(this.cv + '%'); }
        });
    });

There is no need to change the styles and other details.....

Demo: http://jsfiddle.net/renishar/DWvsh/20/

这篇关于如何在jQuery.knob中添加值后缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆