troubleshooting Question

jQuery: Elements with class name beginning with term

Avatar of hankknight
hankknightFlag for Canada asked on
4 Comments1 Solution256 ViewsLast Modified:
Using jQuery, how can I select all elements that have a class name beginning with "hello"?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

<script type="text/javascript" src=""></script>
<script type="text/javascript">

$(document).ready(function() {
 $('.hello*').each(function(index) {	


<h1 class="helloH">Heading</h1>
<div class="hello1">1</div>
<div class="hello2">2</div>
<div class="hello3">3</div>
<p class="nomatch">This should not be included</p>
<p class="helloP">ABC</p>
<p class="helloXYZ">XYZ</p>

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros