views:

50

answers:

2

Hi,

I have a website that changes his inputs ids, and I'm trying to make a semi auto-login, filling automatically the email and the password part...

I'm doing this with greasemonkey and jQuery...

I'm trying something like this

$("input[@type=text]").setValue("[email protected]");

but had no success... The Page has only the login part, two text type inputs...

What am I missing here?

+4  A: 

jQuery changed it's selectors (to match CSS3 selectors, find all selectors here). Try

$("input[type=text]").val("[email protected]");
Marcel J.
and who do I fill the password now? is there a way to first fill an input with a text and then fill another one with other text?
Shady
Well, the password should be `type="password"`. And otherwise, try to use the `name` of the input. `$("input[name=check_what_it_is_called]")...`
Marcel J.
+2  A: 

There is no setValue() method. Use val(). Assuming:

<input type="text" id="email" name="email">

use:

$("#email").val("[email protected]"); // ID selector

If it doesn't have an ID:

$("input[name=email]").val("[email protected]");

But favour IDs over attribute selectors where possible.

The problem with:

$("input[type='text']").val("...");

is that it will assign a value to only the first text input on the form. If that's the right one, I guess that's fine. But if you're filling in multiple different inputs you need a different selector.

cletus
where does the #pwd come from, just wondering
Jorge Israel Peña
@Blaenk ah fixed that.
cletus