for live demo see this link : http://jsfiddle.net/nanoquantumtech/XBcrv/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
(function ($) {
$.extend($.expr[':'], {
bt: function (elem, i, match) {
return ((parseInt(match[3].split(',')[0]) < i) && (i < parseInt(match[3].split(',')[1])));
},
nbt: function (elem, i, match) {
return !((parseInt(match[3].split(',')[0]) < i) && (i < parseInt(match[3].split(',')[1])));
},
bte: function (elem, i, match) {
return ((parseInt(match[3].split(',')[0]) <= i) && (i <= parseInt(match[3].split(',')[1])));
},
nbte: function (elem, i, match) {
return !((parseInt(match[3].split(',')[0]) <= i) && (i <= parseInt(match[3].split(',')[1])));
}
});
})(jQuery);
$(document).ready(function () {
$("#test1 td:bt(3,5)").css("color", "red");
$("#test2 td:bte(3,5)").css("color", "red");
$("#test3 td:nbt(3,5)").css("color", "red");
$("#test4 td:nbte(3,5)").css("color", "red");
});
</script>
<style type="text/css">
table
{
margin: 25px 0px;
}
h1
{
font-weight: bolder;
font-size: 18px;
}
</style>
</head>
<body>
<h1>
Between ( $("#test1 td:bt(3,5)").css("color", "red"); )</h1>
<table id="test1" border="1">
<tr>
<td>
TD #0
</td>
<td>
TD #1
</td>
<td>
TD #2
</td>
</tr>
<tr>
<td>
TD #3
</td>
<td>
TD #4
</td>
<td>
TD #5
</td>
</tr>
<tr>
<td>
TD #6
</td>
<td>
TD #7
</td>
<td>
TD #8
</td>
</tr>
</table>
<h1>
Between And Equals ( $("#test2 td:bte(3,5)").css("color", "red"); )</h1>
<table id="test2" border="1">
<tr>
<td>
qTD #0
</td>
<td>
qTD #1
</td>
<td>
qTD #2
</td>
</tr>
<tr>
<td>
qTD #3
</td>
<td>
qTD #4
</td>
<td>
qTD #5
</td>
</tr>
<tr>
<td>
qTD #6
</td>
<td>
qTD #7
</td>
<td>
qTD #8
</td>
</tr>
</table>
<h1>
Not Between ( $("#test3 td:nbt(3,5)").css("color", "red"); )</h1>
<table id="test3" border="1">
<tr>
<td>
wTD #0
</td>
<td>
wTD #1
</td>
<td>
wTD #2
</td>
</tr>
<tr>
<td>
wTD #3
</td>
<td>
wTD #4
</td>
<td>
wTD #5
</td>
</tr>
<tr>
<td>
wTD #6
</td>
<td>
wTD #7
</td>
<td>
wTD #8
</td>
</tr>
</table>
<h1>
Not Between And Equals ( $("#test4 td:nbte(3,5)").css("color", "red"); )</h1>
<table id="test4" border="1">
<tr>
<td>
rTD #0
</td>
<td>
rTD #1
</td>
<td>
rTD #2
</td>
</tr>
<tr>
<td>
rTD #3
</td>
<td>
rTD #4
</td>
<td>
rTD #5
</td>
</tr>
<tr>
<td>
rTD #6
</td>
<td>
rTD #7
</td>
<td>
rTD #8
</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
(function ($) {
$.extend($.expr[':'], {
bt: function (elem, i, match) {
return ((parseInt(match[3].split(',')[0]) < i) && (i < parseInt(match[3].split(',')[1])));
},
nbt: function (elem, i, match) {
return !((parseInt(match[3].split(',')[0]) < i) && (i < parseInt(match[3].split(',')[1])));
},
bte: function (elem, i, match) {
return ((parseInt(match[3].split(',')[0]) <= i) && (i <= parseInt(match[3].split(',')[1])));
},
nbte: function (elem, i, match) {
return !((parseInt(match[3].split(',')[0]) <= i) && (i <= parseInt(match[3].split(',')[1])));
}
});
})(jQuery);
$(document).ready(function () {
$("#test1 td:bt(3,5)").css("color", "red");
$("#test2 td:bte(3,5)").css("color", "red");
$("#test3 td:nbt(3,5)").css("color", "red");
$("#test4 td:nbte(3,5)").css("color", "red");
});
</script>
<style type="text/css">
table
{
margin: 25px 0px;
}
h1
{
font-weight: bolder;
font-size: 18px;
}
</style>
</head>
<body>
<h1>
Between ( $("#test1 td:bt(3,5)").css("color", "red"); )</h1>
<table id="test1" border="1">
<tr>
<td>
TD #0
</td>
<td>
TD #1
</td>
<td>
TD #2
</td>
</tr>
<tr>
<td>
TD #3
</td>
<td>
TD #4
</td>
<td>
TD #5
</td>
</tr>
<tr>
<td>
TD #6
</td>
<td>
TD #7
</td>
<td>
TD #8
</td>
</tr>
</table>
<h1>
Between And Equals ( $("#test2 td:bte(3,5)").css("color", "red"); )</h1>
<table id="test2" border="1">
<tr>
<td>
qTD #0
</td>
<td>
qTD #1
</td>
<td>
qTD #2
</td>
</tr>
<tr>
<td>
qTD #3
</td>
<td>
qTD #4
</td>
<td>
qTD #5
</td>
</tr>
<tr>
<td>
qTD #6
</td>
<td>
qTD #7
</td>
<td>
qTD #8
</td>
</tr>
</table>
<h1>
Not Between ( $("#test3 td:nbt(3,5)").css("color", "red"); )</h1>
<table id="test3" border="1">
<tr>
<td>
wTD #0
</td>
<td>
wTD #1
</td>
<td>
wTD #2
</td>
</tr>
<tr>
<td>
wTD #3
</td>
<td>
wTD #4
</td>
<td>
wTD #5
</td>
</tr>
<tr>
<td>
wTD #6
</td>
<td>
wTD #7
</td>
<td>
wTD #8
</td>
</tr>
</table>
<h1>
Not Between And Equals ( $("#test4 td:nbte(3,5)").css("color", "red"); )</h1>
<table id="test4" border="1">
<tr>
<td>
rTD #0
</td>
<td>
rTD #1
</td>
<td>
rTD #2
</td>
</tr>
<tr>
<td>
rTD #3
</td>
<td>
rTD #4
</td>
<td>
rTD #5
</td>
</tr>
<tr>
<td>
rTD #6
</td>
<td>
rTD #7
</td>
<td>
rTD #8
</td>
</tr>
</table>
</body>
</html>