Opened 10 years ago
Closed 9 years ago
#25809 closed defect (bug) (worksforme)
wpColorPicker Shows Twice When First Added to Sidebar
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8.1 |
Component: | Widgets | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
When using the wpColorPicker
in a widget, the first time the Widget is added to the sidebar, the color picker shows twice. Only one of the pickers is functional. After saving, only one color picker is shown and everything is fine.
I found a similar ticket here - #23293. That ticket was marked as invalid, but I think this issue needs to be revisited, as the documented solution does not work.
Here's the code I've tried adding inside of the widget's form
function and the corresponding results:
<script> jQuery(document).ready(function($) { $(document).ajaxComplete(function() { $('.color-picker').wpColorPicker(); }); }); </script>
The above shows two color pickers in the widget's settings, only one of which is functional.
<script> jQuery(document).ready(function($) { $('.color-picker').wpColorPicker(); }); </script>
The above shows two color pickers in the widget's settings, only one of which is functional.
<script> jQuery(document).ready(function($) { jQuery("#widgets-right .widgets-sortables").on("sortstop", function(event, ui) { jQuery(".color-picker").wpColorPicker(); }); }); </script>
The above shows two color pickers in the widget's settings, none of which work.
I've tried downloading third party plugins to see how they do it, and they suffer from the same duplicate color picker issue.
Main Plugin File