Virangya,
Unless you need to specifically exclude elements in the document's head, then you can simplify to $('div[class^="suf-"]'); .
But as they point out in the jQuery documentation, this form of selector is slow (because internally jQuery has to use a regExp).
It's better to separate out the prefix "suf" as a class in its own right.
<div class="suf text"><div>
<div class="suf gang"><div>
<div class="suf hub"><div>
Now you can select all "suf"s with the much quicker $(".suf") .
And to select by the other part of the className:
$(".text")...;
$(".gang")...;
$(".hub")...;
Or, to be certain that you select only "text", "gang", "hub" in combination with "suf", then you can set ".suf" as the context of the other class selector:
$(".text", ".suf")...;
$(".gang", ".suf")...;
$(".hub", ".suf")...;
As the context can also be a previously-created jQuery object, you can make multiple selections of this type more efficient by pre-selecting all "suf"s:
$allSufs = $(".suf");
$(".text", $allSufs)...;
$(".gang", $allSufs)...;
$(".hub", $allSufs)...;
Airshow
Airshow
WiFi Lounge Lizard
2,782 posts since Apr 2009
Reputation Points: 370
Solved Threads: 388
Skill Endorsements: 9
i mean there can be other classes assigned to that same tag..
Yes, that's the whole point!
Multiple classes per tag make prefixes like "suf-" unnecessary.
Airshow
Airshow
WiFi Lounge Lizard
2,782 posts since Apr 2009
Reputation Points: 370
Solved Threads: 388
Skill Endorsements: 9