Solved

Need built in jQuery "string endsWith" functionality

Posted on 2011-09-28
4
367 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Expert Comment

by:pivar
ID: 36717480
Hi,

Try

str.match(/Error.jpg$/)

/peter
0
 
LVL 22

Accepted Solution

by:
pivar earned 500 total points
ID: 36717484
Oh sorry, should be

str.match(/Error\.jpg$/)
0
 
LVL 22

Expert Comment

by:pivar
ID: 36717504
And to test if it ends with

if (str.match(/Error\.jpg$/) != null)
0
 

Author Closing Comment

by:newbieweb
ID: 36717573
Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Handling case and special names in javascript 3 51
embadded search engine in website 4 47
Jquery Calculation 3 42
Error Handler 8 43
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question