-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Value changed although readOnly is true #277
Comments
Try data-readonly, no capital O. In the code it is looking for the data attr "readyonly". I just tested it and it worked for me. @githubjeka |
In https://github.com/aterrien/jQuery-Knob#options described <div style="display: inline; height: 110.88px; width: 110.88px;">
<canvas width="110" height="110.88"></canvas>
<input value="0.05" class="knob" data-fgcolor="#f39c12" style="width: 59px; height: 36px; position: absolute; vertical-align: middle; margin-top: 36px; margin-left: -85px; border: 0px; font-weight: bold; font-style: normal; font-variant: normal; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Arial; text-align: center; color: rgb(243, 156, 18); padding: 0px; -webkit-appearance: none; background: none;">
</div> when <div style="display: inline; height: 110.88px; width: 110.88px;">
<canvas width="110" height="110.88"></canvas>
<input value="0.05" class="knob" data-fgcolor="#f39c12" readonly="readonly" style="width: 59px; height: 36px; position: absolute; vertical-align: middle; margin-top: 36px; margin-left: -85px; border: 0px; font-weight: bold; font-style: normal; font-variant: normal; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Arial; text-align: center; color: rgb(243, 156, 18); padding: 0px; -webkit-appearance: none; background: none;">
</div> But when clicked as described above then readonly doesn't work for float of value. |
I encontered the same problem too, the existing version seems not to support floating number. So I use a number which is [0,1000] to represent a floating number (n * 1000), and at the fortmat hook function, format it like |
I debug the library, and the problem is that trigger a 'blur' event when you click several times |
i change the code in line 175 -176 and add ...
this.$.bind(
'change blur',
function(ev) {
if (ev.type == "blur" && $(this).prop("readonly")) return;
s.val(s._validate(s.o.parse(s.$.val())));
var v = s._validate(s.o.parse(s.$.val()));
if (s.cH && s.cH(v) === false) return;
s.val(v);
}
);
... and this solve the problem for me, meybe something like this is needed in the other blur event, i dont test that |
I ran into this problem and you solution worked great. thanks @ghernandezr |
Had the same problem. Solved including the attribute disabled="disabled" in the input tag, it avoided the calling of any knob event. |
Clicked by input
Clicked in any place and get 1
P.S. chrome browser
The text was updated successfully, but these errors were encountered: