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
$(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 + "<br/>");
$("#xyz").append(jQuery.inArray(this, arr2)+"<br/>");
});
});
});