I don't it possible neither in JS.

You can make it like this:

catch the onclick event and erase the text, or maybe the onkeypress
event...
$('#textbox').keypress(function () {
 if ($(this).val() == 'default text')
  $(this).val('');
});

You can disable the submit button like this:

$('#submitButtonId').attr('disabled', 'disabled');

But you should capture some event on the text box to validate it
(onblur for example) and enable the button when needed.

Regards,
Emil Ivanov

On May 19, 12:14 am, "S. Robert James" <[EMAIL PROTECTED]> wrote:
> Is this just impossible to do?
>
> On May 18, 2:21 pm, "S. Robert James" <[EMAIL PROTECTED]> wrote:
>
> > I'd like to prefill a text box in a form with a typical value, but
> > select the text, so that if the user begins typing, the prefilled text
> > is overwritten, wihtout him having to erase it.  (Just like the
> > location bar in my browser - if I click on it, the text becomes
> > selected, so that one key overwrites the old location, without me
> > having to backspace.)
>
> > Can I do this with JQuery/JavaScript? How?
>
> > Also, is there a way to disable the submit button unless the text in
> > the box validates (in this case, it has to be filled out, and it has
> > to be numeric)?

Reply via email to