Surendra Sharma

Surendra Sharma

Search This Blog

Saturday, March 7, 2015

How to find any word in string using Jquery

This is simple but very useful method in Jquery to find any word or presence of any substring in any string.

if ($('#txtSearch').val().indexOf('?') < 0)

Here if “?” is present in textbox value then indexIf() method return the position of word in string otherwise return -1 in case of not present.

Please leave your comments or share this tip if it’s useful for you.

No comments:

Post a Comment