Ahmed Sazar Ahmed Sazar - 4 months ago 21
Javascript Question

Jquery in MVC ...IndexOf not working

I have Jqury function in my MVC project.

Why do IndexOf in my function not working ?

/// <reference path="jquery-1.10.2.js" />

$(document).ready(function () {

$('#finpost').keyup(function ()
{
$("#CityId > option").each(function () {


var t = this.text.toUpperCase();
alert(t.IndexOf('2200'));

});


});


});

Answer

Javascript is a case sensitive language.

Use alert(t.indexOf('2200')); instead of alert(t.IndexOf('2200'));