As I venture into the world of HTML coding, I am struggling to implement a jQuery simple color picker to change the background color. Despite my efforts with various color pickers, I can't seem to make the background and display box respond correctly.
Click here for more information on the jQuery UI Slider Colorpicker.
The code I have utilized from the website can be found below:
<!doctype html>
<html lang='en'>
<head>
<!-- Source https://jqueryui.com/slider/#colorpicker, retrieved Feb 2018
added missing 'https:' to line 7
removed local call to /resources/demos/style.css line 8-->
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>jQuery UI Slider - Colorpicker</title>
<link rel='stylesheet' href='https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css'>
<style>
#red, #green, #blue {
float: left;
clear: left;
width: 300px;
margin: 15px;
}
#swatch {
width: 120px;
height: 100px;
margin-top: 18px;
margin-left: 350px;
background-image: none;
}
#red .ui-slider-range { background: #ef2929; }
#red .ui-slider-handle { border-color: #ef2929; }
#green .ui-slider-range { background: #8ae234; }
#green .ui-slider-handle { border-color: #8ae234; }
#blue .ui-slider-range { background: #729fcf; }
#blue .ui-slider-handle { border-color: #729fcf; }
</style>
<script src='https://code.jquery.com/jquery-1.12.4.js'></script>
<script src='https://code.jquery.com/ui/1.12.1/jquery-ui.js'></script>
<script>
// JavaScript functions for handling color selection
</script>
<body>
<p>Customize your colors using the interactive sliders:</p>
<div id='red'></div>
<div id='green'></div>
<div id='blue'></div>
<div id='swatch' class='ui-widget-content ui-corner-all'></div>
</body>
</html>