Пример:
Функция ищет значения переменных массива в тексте элементов div.
"jQuery"
var arr = [ 4, "Pete", 8, "John" ];
$("span:eq(0)").text(jQuery.inArray("John", arr));
$("span:eq(1)").text(jQuery.inArray(4, arr));
$("span:eq(2)").text(jQuery.inArray("David", arr));
"HTML"
<div>"John" found at <span></span></div> <div>4 found at <span></span></div> <div>"David" found at <span></span></div>
"CSS"
div { color:blue; }
span { color:red; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
var arr = [ 4, "Pete", 8, "John" ];
$("span:eq(0)").text(jQuery.inArray("John", arr));
$("span:eq(1)").text(jQuery.inArray(4, arr));
$("span:eq(2)").text(jQuery.inArray("David", arr));
});
</script>
</head>
<body class="iframe">
<div>"John" found at <span></span></div>
<div>4 found at <span></span></div>
<div>"David" found at <span></span></div>
</body>
</html>
<style>
div { color:blue; }
span { color:red; }
</style>