Comments (6)
You can always access the current input value using the jquery .val()
function.
from bootstrap-colorpicker.
How though? I would like to change the colour shown in the <i></i>
to represent the colour in the text box, is there anyway to work out which textbox the .colorpicker() is working on?
from bootstrap-colorpicker.
I don't know exactly what you are asking for, if you want to change the color programmatically you can use .colorpicker('setValue', '#000000')
, as specified in the documentation
from bootstrap-colorpicker.
i'll try to explain it better:
On my web page, i have 2 textboxes that upon loading the page, contain a value, eg:
<div class="input-group colourpicker">
<input type="text" class="form-control" id="TopOnColour1" name="TopOnColour1" value="#FFFF00">
<span class="input-group-addon"><i></i></span>
</div>
<div class="input-group colourpicker">
<input type="text" class="form-control" id="TopOffColour1" name="TopOffColour1" value="#FF0000">
<span class="input-group-addon"><i></i></span>
</div>
In my javascript code, i do the following: $(".colourpicker").colorPicker({format: "hex"});
The colorpicker component gets added to the right hand side of the textbox however it defaults to the colour black.
What i would like to do, is upon page load, have the colorpicker component reflect the actual colour that is in the textbox itself.
from bootstrap-colorpicker.
I tested your code and it works, the colorpickers have the right color: http://jsfiddle.net/z28Pf/2/
If you want to change the color (in the input and in the colorpicker) before plugin initialization you should use the statement of my previous reply (you can see the differences in the demo).
from bootstrap-colorpicker.
Ahh, i see, thanks for that.
from bootstrap-colorpicker.
Related Issues (20)
- website can't open by my network! HOT 2
- Extension not working with `inline: false` HOT 1
- bootstrap v5 alpha1 HOT 1
- How to hide the color value input text, replace by free user input HOT 1
- autoInputFallback=false converts #ff0 to #ffff00 but I wasn't done typing yet HOT 1
- .RemoveData() in colorpicker destroy doesn't remove the color data
- Dist files HOT 1
- Container selector won't work if colorpicker target is an input HOT 1
- useAlpha changes formats from RGBA to RGB if alpha is 1 HOT 2
- Disable hex input auto completing HOT 4
- Show picker on input focus together with colorpicker-input-addon HOT 2
- With Bootstrap usage doesn't work with Bootstrap 5 HOT 7
- Hue selector gets locked when the color has no saturation (gray scale) HOT 1
- Make it work with webpack and Bootstrap 5
- [BUG] popper.js deprecated
- [FEATURE] Bootstrap5
- Having the input hex value in lower case does not set the picker color
- If, Browser window if zoom to 125% the colour picker doesn't work properly
- Add colour through text field HOT 1
- [BUG] Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-colorpicker.