Topic: Can I use the Bootstrap Color Picker plugin in an HTML Form input field?

SEWO free asked 5 years ago


How can I use the Bootstrap Color Picker plugin in an HTML Form input field?

My thinking is that I can have a hidden input field in the HTML form and then add the basic color picker (small square) in the form and when the user saves a color, use the value returned from the color picker (using JavaScript/JQuery) to place the value into the 'value=""' attribute of the hidden input field.

Would that be the correct way to do this? Or is there a better way?

I wish to send the chosen color as a $_POST variable when the form is submitted.

A sample of the JavaScript/JQuery code would be good if someone has done something like this.


Konrad Stępień staff answered 5 years ago


Hi @SEWO,

I think a good way is to set the value to Input element and hide them or remove border etc to replace the element styles with the same ones as the span.

Tell me if it meets your expectations.

Best regards, Konrad.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.5
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No