ITSolution
ITSolution

Reputation: 398

jQuery check if text is non-english

I want check if text is non-english charachter , i wrote this code but unfortunately not working:

var objsts = $('a');
var english = /^[A-Za-z0-9]*$/;

$.each(objsts, function () {
var $this = $(this);
if (!$this.html() == english)
$this.addClass('active');
});

any solution?

Upvotes: 1

Views: 2619

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

Since english is a regex use the test() method

if (!english.test($this.html()))

Upvotes: 1

Related Questions