Hi, I need to put this code inside a normal input.
onchange="document.getElementById("dColor").style.backgroundColor = '#' + this.color"
How do I do this?
Thanks
Hi, I need to put this code inside a normal input.
onchange="document.getElementById("dColor").style.backgroundColor = '#' + this.color"
How do I do this?
Thanks
Any?
You would need to view the source, get the input ID and then plug that into your script so it would know what it's supposed to change. You would place your script in your theme's header.php file wherever your particular theme recommends you to place custom script blocks.
Hi Kevin, thanks for the response. The ONCHANGE event its supposed to happend inside a input text, here is the example:
<input id="txtColor" class="color" onchange="document.getElementById("dColor").style.backgroundColor = '#' + this.color" >
How can I achieve this?
You would need to use this filter to modify the input.
http://www.gravityhelp.com/documentation/page/Gform_field_input
Hi Kevin, thank you for the quick response. I would really appreciate you If you can give me the actual code for this. I read the link you pass me, but I'm not good programming.
I know you shouldn't do this for me, but could you exception this time?
The name of the input is: input_3_9 and what i need to insert this input is onchange="document.getElementById("dColor").style.backgroundColor = '#' + this.color"
Thanks mate.
Place this class name on the field in question: change_class
Then use this:
<?php
add_action("gform_field_input", "map_input", 10, 5);
function map_input($input, $field, $value, $lead_id, $form_id){
if($field["cssClass"] == "change_class"){
$input = '<input id="txtColor" class="color" onchange="document.getElementById("dColor").style.backgroundColor = "#" + this.color" >';
}
return $input;
}
?>
Thanks