Need built in jQuery "string endsWith" functionality

I need to use jQuery to find if a string ends with "Error.jpg";

I use var but could use any type you suggest.

How do I do this?

Thanks.
newbiewebSr. Software EngineerAsked:
Who is Participating?
 
pivarCommented:
Oh sorry, should be

str.match(/Error\.jpg$/)
0
 
pivarCommented:
Hi,

Try

str.match(/Error.jpg$/)

/peter
0
 
pivarCommented:
And to test if it ends with

if (str.match(/Error\.jpg$/) != null)
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.