javascript - How to find out which text field has been used in jquery function -
javascript - How to find out which text field has been used in jquery function -
i have next form :
<input name="linkcolor" type="text" id="colorpickerfield0" > <input name="linkcolor" type="text" id="colorpickerfield1" > <input name="linkcolor" type="text" id="colorpickerfield2" >
in function below, how may find out text field has been invoked. example, want set conditions in onsubmit function if #colorpickerfield0 blah blah, , if #colorpickerfield1 blah blah blah etc etc. help appreciated. thanks
$('#colorpickerfield0, #colorpickerfield1, #colorpickerfield2').colorpicker({ onsubmit: function(hsb, hex, rgb, el) { alert($(this)); // if #field0 // statements // if #field1 // statements // if #field2 // statemets $(el).val(hex); $(el).colorpickerhide(); }, onbeforeshow: function () { $(this).colorpickersetcolor(this.value); } }) .bind('keyup', function(){ $(this).colorpickersetcolor(this.value); });
i'm using http://www.eyecon.ro/colorpicker/
if alert($(this).attr('id')); undefined, still can't tell 1 used.
if ($(el).attr('id') == 'colorpickerfield0') { ... }
javascript jquery color-picker
Comments
Post a Comment