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 6362083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:51:43+00:00 2026-05-24T23:51:43+00:00

when I write this code: <script type=text/javascript> function showhide(master, detail) { var src =

  • 0

when I write this code:

<script type="text/javascript">
        function showhide(master, detail) {
            var src = $(master).children()[0].src;
            if (src.endsWith("plus.png"))
                src = src.replace('plus.png', 'minus.png');
            else
                src = src.replace('minus.png', 'plus.png');

            $(master).children()[0].src = src;

            $(detail).slideToggle("normal");
        }
</script>

and reference jQuery library in ScriptManager:

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/scripts/jquery-1.4.1.min.js" ScriptMode="Release" />
    </Scripts>
</asp:ScriptManager>

every thing is ok.but when I commnet above code and reference jQuery In head part:

<script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

debugger alert me that for endsWith : Object doesn't support this property or method

why asp.net has this behaivior?

thanks

  • 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-24T23:51:43+00:00Added an answer on May 24, 2026 at 11:51 pm

    In this line of your code:

    if (src.endsWith("plus.png"))
    

    You are assuming that the string object has a method called endsWith(), but standard javascript does not have such a method. There are various extensions that add that method to the string object (it’s a simple one to write), but you cannot assume it is there unless you’ve specifically added it to the String object prototype.

    I can’t explain why it ever works unless one of the two configurations has a library that installs this extension. It is not part of jQuery.

    Here’s an earlier SO question about adding an endsWith() method: endsWith in JavaScript and I happen to like this particular post in that discussion: endsWith in JavaScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure I'm going to have to write supporting javascript code to do this.
Is there a better way to write this code? I want to show a
Eg. can I write something like this code: public void InactiveCustomers(IEnumerable<Guid> customerIDs) { //...
This code does not seem to compile, I just need to write something to
When I write code like this in VS 2008: .h struct Patterns { string
Many beginning programmers write code like this: sub copy_file ($$) { my $from =
If I'm using a Hashtable , I can write code like this: object item
The code that I want to write is like this: void MethodOnThreadA() { for
What criteria should I use to decide whether I write VBA code like this:
I often find I want to write code something like this in C#, but

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.