How to check whether a value exists in a array in Jquery
<p>Here is the script i wrote to read each character from a textbox and checking whether that character exists in a array but this isn't working correctly as i'm getting a -1 for any character i enter into the textbox despite of whether its there or not in the array i'm searching that value. Can anyone please help</p>

<pre><code>$(document).ready(function()
{
    var arr1;
    var arr2= $("#myValue").val().split("");

    $("#TextBox1").keyup(function ()
    { 
        arr1 = $("#TextBox1").val().split("");
    });

    $("#btn").click(function ()
    { 
        jQuery.each(arr1, function(i, val)
        {
            $("#xyz").append(this + "&lt;br/&gt;");
            $("#xyz").append(jQuery.inArray(this, arr2)+"&lt;br/&gt;");
        });
    });
});
</code></pre>
