/    Sign up×
Community /Pin to ProfileBookmark

<td> and class problem

[B][COLOR=”Blue”][SIZE=”3″]Can we keep two class in <td> ? I have put class=”selectColumn” and class=”selectColumnAmericas” as below.

when I run JQuery on these they return different size .

how to solve this ?
[/SIZE][/COLOR][/B]

[CODE]
<td width=”33″ class=cellTextGreyLeft><input type=”checkbox” class=”selectColumn” class=”selectColumnAmericas” name=”strCustTerr1″ value=”” align=”middle” /></td>

<td width=”33″ class=cellTextGreyLeft><input type=”checkbox” class=”selectColumn” class=”selectColumnAmericas” name=”strCustTerr2″ value=”” align=”middle” /></td>

<td width=”33″ class=cellTextGreyLeft><input type=”checkbox” class=”selectColumn” class=”selectColumnAmericas” name=”strCustTerr3″ value=”” align=”middle” /></td>

………………………………
………………………………
[/CODE]

[B][U]JQuery[/U][/B]

var param=”selectColumn”;//
alert(param);
alert($(“.”+param).size()) => [COLOR=”Red”]16[/COLOR]

var param=”selectColumnAmericas”;
alert(param);
alert($(“.”+param).size()) => [COLOR=”Red”]0[/COLOR]

I want both of them to return same values . whats the fix here ?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@PrisJul 04.2010 — You can combine classes in your HTML file like so:
[CODE]class="selectColumn selectColumnAmericas"[/CODE] Don't forget the space character and the quotation marks.
Copy linkTweet thisAlerts:
@cofactorauthorJul 04.2010 — You can combine classes in your HTML file like so:
[CODE]class="selectColumn selectColumnAmericas"[/CODE] Don't forget the space character and the quotation marks.[/QUOTE]


This works fine . Thanks a lot.

Could you please also tell , if I want to exclude input elements with some certain class values , how to write that in JQuery ?
Copy linkTweet thisAlerts:
@Declan1991Jul 04.2010 — Well jQuery supports :not() so you could use $(".selectColumn:not(.somethingelse)");
Copy linkTweet thisAlerts:
@cofactorauthorJul 05.2010 — Awesome . This is very much useful.

Could you also please help at this part ?

I have a <td> like this...

<td width="33" class=cellTextGreyLeft><input type="checkbox" class="selectColumn [COLOR="Red"][B]selectColumnAmericas[/B][/COLOR] [B][COLOR="Red"]column17[/COLOR][/B] " name="strCustTerr1" value="" align="middle" /></td>

I want to pick data [COLOR="Red"][B]Americas[/B][/COLOR] , [B][COLOR="Red"]column17[/COLOR][/B] and [COLOR="Red"][B]17[/B][/COLOR] when a user click on this td .

what JQuery syntax I should be using here ?
×

Success!

Help @cofactor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...