bebraw / colorjoe

Scaleable color picker with touch and AMD support (MIT)

Home Page:http://bebraw.github.io/colorjoe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enter hex number in HTML form

simetin opened this issue · comments

Hi guys !
I have setup the colorpicker in an HTML form, but I'm facing an issue. When I try to enter manually the hex number and press enter, it submit the form.

Any idea for a solution ?

@tchinou1 You might need to add event.preventDefault somewhere in the input logic. This might mean we need to tweak colorjoe itself as this is the sane way to do it.

See also http://stackoverflow.com/a/895231/228885 .

I've tried something like bellow, but it don't work. Have I made a mistake ?

$(document).ready(function() {
$(window).keydown(function(event){
if($('.colorPicker').css('display') == 'inline-block'){
event.preventDefault();
return false;
}
});
});