Suppose you have some <div>
s:
<div id="div_num1"></div>
<div id="div_num2"></div>
<div id="div_num3"></div>
You can select all those divs by choosing $("div[id^='div_num']")
. How can you buld a function that references the number succeeding the prefix?
For example, a function which will alert the number 3 for "div_num3"
.
More generally, how can you use full-blown regex in jQuery selectors?