Jump to content

backspace keypress not supported in chrome...


The Little Guy

Recommended Posts

I am using jquery, and I would like to force the first text in the text box to be http:// I would like it so a user can not delete that text.

 

any suggestions on how to keep it there?

 

I would use keypress(), but the backspace isn't supported in Chrome.

 

keydown deletes the last "/"

keyup deletes the last "/" then adds it back.

 

Here is the code (replace keypress with keyup/keydown):

$("#domainTest").keypress(function(){
if(!$(this).val().match(/^http:\/\//)){
	$(this).val("http://");
	return false;
}
});

 

So, what can I do?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.