I've got a text box that the user inputs a hex value for a colour. The text box will change colour to the hex value entered, however the problem is that if the input is a shade of black, or any dark colour, it is very difficult, or impossible to see what hex value has been entered. So I want the inputted text to have a different coloured outline, for example white so the user is clearly able to see what they have entered.
This is a part of my code:
<head>
<style>
#ColourInput { /* apply this style to element id="ColourInput" */
left: 240px;
top: 60px;
width: 100px;
}
input[type=text]:focus {
border: 3px solid #555;
</style>
<script>
function fnCustomColour() {
var sHexValue = document.getElementById("ColourInput").value;
var ValueValid = 0
fnDebugMessage(sHexValue);
if (/[0-9A-F]{6}$/i.test(sHexValue)) {
if (sHexValue.indexOf("#") === 0) {
} else {
sHexValue = "#"+sHexValue
}
ValueValid = 1
} else {
alert("Value not allowed");
ValueValid = 0
}
if (ValueValid = 1) {
ColourInput.style.backgroundColor = sHexValue;
fnSetFillColour(sHexValue);
fnDebugMessage(sHexValue);
}
}
</script>
</head>
<div id="CustomColour">
Custom Colour Input: #<input type="text" id="ColourInput" name="CustomColour" placeholder="Enter Hex Value" pattern="[a-fA-F0-9]{8}$/i"><br>
<input type="submit" onclick="fnCustomColour();" id="ColourSubmit" value="Submit">
</div>
Any help will be appreciated