eastboundr
eastboundr

Reputation: 1877

Jquery selector not working in Chrome?

I used Jquery to select two elements and hide them with their attributes by the following:

$('input[name=login]').hide();

$('span[class=forgot]').hide();

Both lines properly selects the desired elements and hide them well in FF and IE. However in chrome, the selector is not picking up the object. Anything I should do differently?

Upvotes: 1

Views: 1975

Answers (6)

eastboundr
eastboundr

Reputation: 1877

Thanks guys, turns out there is some issue with me referencing the Jquery library.

I do not know what is the reason, but referencing the library does not seem to be working.

After I copy pasted the entire Jquery Js file into the code. Everything works.

Again Thanks all for your help.

Upvotes: 0

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28578

You should try:

$(document).ready(function(){
 $("input[name='login']").hide();    
 $('span.forgot').hide();
});

Upvotes: 0

PRAH
PRAH

Reputation: 680

look for console errors in developer tool.

you can try with

jQuery('input[name=login]').hide();

jquery('span[class=forgot]').hide();

Upvotes: 0

andyg
andyg

Reputation: 73

For the span selector, you can use:

$('span.forgot').hide();

As for the input, you can use:

$('input[name="login"]').hide();

Upvotes: 0

dKen
dKen

Reputation: 3127

It may be that you're missing quotes:

$('input[name="login"]').hide();

Also, for classes, you might as well use the native selector:

$('span.forgot').hide();

Upvotes: 2

nick
nick

Reputation: 3711

You should use:

 $('input[name="login"]').hide();

 $('span[class="forgot"]').hide();

(note the additional quotes)

Upvotes: 3

Related Questions