Skip to content

Prefixing $ in format function #220

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

Open
chivalrousgaurav opened this issue Jul 15, 2014 · 4 comments
Open

Prefixing $ in format function #220

chivalrousgaurav opened this issue Jul 15, 2014 · 4 comments

Comments

@chivalrousgaurav
Copy link

The format function works fine if you have to suffix anything like %, but if you prefix anything it breaks the code and you can no longer use mouse scroll to control the knob.

I used this:

$(".dial").knob({
'min': 1
,'max':500,
format: function(v) {
return "$" + v ;
}
});

@jarombrown
Copy link

Has there been any update here or were you able to find a work around?

@Dams591
Copy link

Dams591 commented Dec 7, 2015

Same issue here, can't find a way to make it work :( Did you by any chance ?

@marcoramires
Copy link

Same issue here.

format: function (value) {
    if (type == '$') {
        value = '$' + value.toLocaleString();
    }
    return value
};

Input: 30000
Output: $30,000

Cheers

@cericthered
Copy link

I believe this is very similar to another issue I fixed, with commas in the formatted value. See pull request #318. You would just need to update the code I added to remove anything except numbers before parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants