Welcome to WebmasterWorld Guest from 23.22.136.56

Forum Moderators: open

Message Too Old, No Replies

Missing ) inside jQuery

     
2:42 pm on Mar 16, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1055
votes: 1


I have set CSS selector to be read by all browser like:
selector = {
init: function() {
jQuery(".myboxes [class*="mycolumns-"] :nth-child(3n+3)").css("margin-right", 0);
}
}
There is an error inside validation like
Error: SyntaxError: missing ) after argument list

How to avoid/fix this error?
3:13 pm on Mar 16, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts: 5009
votes: 21


You have double quotes within your double quoted string. Try this:
jQuery('.myboxes [class*="mycolumns-"] :nth-child(3n+3)').css("margin-right", 0);
4:50 pm on Mar 16, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1055
votes: 1


I have tested in the mean time you posted and done as you quoted. It is interesting that [class*="mycolumns-"] is not detected but it works just .myboxes :...

It seems that > sign works for all elements inside (directly) .myboxes but [class*="mycolumns-"] can not detect class inside jQuery due to class added to all elements. As it is secondary level...
6:18 pm on Mar 16, 2015 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts: 5009
votes: 21


I'm not sure I understand what you're saying, but the following works for me:

<div class="myboxes">
<div class="a">
<div class="mycolumns-x">
<div>X</div>
<div>Y</div>
<div>Z</div>
</div>
</div>
</div>


// Makes the Z red
$('.myboxes [class*="mycolumns-"] :nth-child(3n+3)').css("color", "red");
7:32 pm on Mar 16, 2015 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1055
votes: 1


Strange. I'm not sure either.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members