Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:21:52+00:00 2026-05-28T02:21:52+00:00

I downloaded this endsWith function – String.prototype.endsWith = function(suffix) { return this.match(suffix+$) == suffix;

  • 0

I downloaded this endsWith function –

String.prototype.endsWith = function(suffix) {
    return this.match(suffix+"$") == suffix;
}

and am trying to use it to verify a form input with

function validator(form){
    var input = form.user.value;

    if(input.endsWith("vdr")) {
        if(input != ""){
            $('#userb').fadeOut("fast");
            $('#userk').fadeIn("fast");
        }
    }else{
        $('#userk').fadeOut("fast");
        $('#userb').fadeIn("fast");
    }
}

I am using jQuery to show a div. The problem is it doesn’t do anything, and since it works without the check for the endsWith(), it is probably that function that is causing trouble. Why is this not working? Are there any alternatives to the endsWith that will work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:21:52+00:00Added an answer on May 28, 2026 at 2:21 am

    String.match returns an array of matches. Try something like this:

    String.prototype.endsWith = function(suffix) {
        return this.match(suffix+"$")[0] === suffix;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

recently I downloaded this open source project and I am trying to compile it.
I have downloaded the silver light from this http://www.microsoft.com/silverlight// I need to use this
Im trying to get the amont of data downloaded with this - (void)download:(NSURLDownload *)theDownload
I downloaded this plugin: http://code.google.com/p/jquery-autocomplete/ I write this: $(document).ready(function () { $('#txtStoryTags').autocomplete('@Url.Action(GetTags, Thread)', {
I am trying to build a simple Jabber client. I have downloaded this sample
I downloaded this vimrc file. It contains entries for mapping comma seperated keys to
I downloaded a program implemented in Java (in this case, http://julian.togelius.com/mariocompetition2009/index.php ). I first
I recently downloaded an event calendar from this link: http://www.asp.net/downloads/starter-kits/club/EventCalendar.zip I want to use
What does this mean: Next add reference to: MySql.Data actually I have downloaded mysql
I thought this would be very easy. I downloaded the JDK, extracted src.zip, modified

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.