0

I'm using the Farbtastic color picker to change values in an HTML input text box. I have it programmed so that when the hex value inside the text box is changed, it is supposed to execute a JavaScript function that converts the hex value to RGB and sends it to a device that changes the color of an LED light. I've successfully tested this using a button to perform the script, so I'm fairly certain that the function isn't the problem

Here's the relevant HTML code:

<div id="colorpicker"></div>
        <md-input>
            <md-input-container>
                <label>Color</label>
                <input type="text" id="color" name="color" value="#123456" ng-model="color" ng-change="return hexToRGB(document.getElementById('color').value);"/>
            </md-input-container>
        </md-input>

The ng-change seems to be the root of the issue. Is there something I need to change here? Or is there something else that needs to be fixed?

3
  • jsfiddle.net/deathhell/UTn5y/2 That should be a start Commented Feb 8, 2016 at 17:28
  • How does this help? I'm not sure how this is relevant. Commented Feb 8, 2016 at 17:45
  • Sorry, i thought the user was updating the input text box, and not via the color picker. Commented Feb 8, 2016 at 17:49

1 Answer 1

1

Remove the return keyword.

Change:

ng-change="return hexToRGB(document.getElementById('color').value);"

To:

ng-change="hexToRGB(document.getElementById('color').value);"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.