Giter VIP home page Giter VIP logo

Comments (6)

itsjavi avatar itsjavi commented on August 25, 2024

You can always access the current input value using the jquery .val() function.

from bootstrap-colorpicker.

ray73864 avatar ray73864 commented on August 25, 2024

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.

itsjavi avatar itsjavi commented on August 25, 2024

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.

ray73864 avatar ray73864 commented on August 25, 2024

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.

itsjavi avatar itsjavi commented on August 25, 2024

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.

ray73864 avatar ray73864 commented on August 25, 2024

Ahh, i see, thanks for that.

from bootstrap-colorpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.