Saturday, November 3, 2012

using jscolor programatically (no jquery)

jscolor is a color picker javascript

it lets u make an input type="text" into a color picker, just by adding the class .color to the <input tag>

1
it inside a function
(the input tag element, referenced as this) is an OBJECT with property .color which is the chosen color in the colorpicker

2
therefore, you can pass

product_text_color.attr('class', 'color'); // the input box has been made into a jquery object first
// attach color picker to it by adding a class .color to it

{'color': product_text_color.val()}
programatically passing an OBJECT with prop .color to a function:
since you can't directly get the colorpicker, USE JQUERY TO DO IT, and this is the way how.
and then the fn taking this OBJECT as arg, references it like this: colorObj.color





Refer to next post:
jquery get the value of a select box

No comments:

Post a Comment