Select All IDs That Start With "XYZ" jQuery
This fiddle shows a jQuery selector the will select any id (or other parameters can be used) that begin with any value.
by Colin Soderstrom
HTML
<div id="XYZ123"><p>Text 1</p></div>
<div><p id="XYZ456">Text 2</p></div>
<div id="test"><p>Text 3</p></div>
CSS
div {
border: 1px solid black;
width: 200px;
height: 100px;
text-align: center;
margin: 20px;
}
JavaScript
$(document).ready(function() {
$('[id^="XYZ"]').css({"backgroundColor":"red"});
});