Amit Dhamu

Writes Code

ID Is Like

You may have a series of divs on your page which are named similarly such as div1, div2, div3 etc. Without declaring all of those in a jQuery selector, you can filter them as shown below.

HTML

<div id="box1"></div>
<div id="box2"></div>
<div id="box3"></div>



jQuery

$("div[id^=box]").live("click", function() {
     // Do stuff here
});


filter / jquery / like

← Email Using PHPMailer CSS Greater Than Sign →