Reputation: 10430
The blow script works but is also outputting a "type e" error in jquery...
I've been looking at this for about 20mins now and am failing to see the problem.
if ($('input[type="submit"]').hasClass('.grey-button')) {
$(this).wrap('<span class="button grey-button"></span>');
} else {
$(this).wrap('<span class="button"></span>');
}
What am i mssing ?
Upvotes: 0
Views: 31
Reputation: 308
To check the class we doesn't not need . with the selector. changed it as below
.hasClass('grey-button')
Upvotes: 0
Reputation: 20199
Don't need to use .classname
in hasClass()
. just call with classname without dot eg hasClass('classname');
just use
$('input[type="submit"]').hasClass('grey-button')
Upvotes: 2
Reputation: 85545
Checking with hasClass doesn't require to pass selector (the dot):
.hasClass('grey-button')//just use class name
Upvotes: 1