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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:05:17+00:00 2026-06-04T11:05:17+00:00

I have the following in a plug-in script: $(#menu) .on(‘click’,’a[href^=/Test]’,function(event){ event.preventDefault(); var href =

  • 0

I have the following in a plug-in script:

$("#menu")
.on('click','a[href^="/Test"]',function(event){

        event.preventDefault();
        var href = $(this).attr('href');

        alert(this);
        // Load content
        $('#content').load(href, '', function (responseText, textStatus, XMLHttpRequest) {
            $(this).applyTemplateSetup().buildTableOfContent();
        });
        window.location.hash = '#' + href;

        // Get nav link
        var a = $('#menu a[href="' + href + '"]');
        if (a.length > 0) {
            // Mark as current
            $('#menu a').removeClass('current');
            a.addClass('current');

            // Update breadcrumb
            var breadcrumb = $('#breadcrumb').empty();
            while (a.length > 0) {
                if (a.get(0).nodeName.toUpperCase() == 'A') {
                    var target = a;
                }
                else {
                    var target = a.parent().find('a:first');
                }
                breadcrumb.prepend('<li><a href="' + target.attr('href') + '">' +
                a.contents().filter(function () {
                    return this.nodeType == 3;
                }).first().text()
                + '</a></li>');

                // Check if opened
                var li = a.parent();
                if (li.hasClass('closed')) {
                    li.removeClass('closed');
                }

                a = li.parent().parent().children('a, span');
            }
        }
    });       

I would like to also set the value of a link when the user clicks. I added this
on my page but it seems like it does not get called. Is there a problem when
I attach two of the same type of events to an element?

$("#menu")
            .on('click', 'a[href^="/Test"]', function (event) {
                event.preventDefault();
                var href = $(this).attr('href');
                var pk = href.substr(7, 4);
                var rk = href.substr(12, 4);
                var link = "/Admin/Testss/Edit?pk=" + pk + "&rk=" + rk;
                $('#editLink').data('href', link);
            });
  • 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-06-04T11:05:18+00:00Added an answer on June 4, 2026 at 11:05 am

    Yes, it should work. Make sure that the code which defines the 2nd handler is actually being executed.

    Alternatively, you could always modify the first handler you attach to call your (multiple) other functions.

    Personally I’d prefer to get the former working as it allows you to attach/detach handlers independantly.

    Do you have the same problem if you use Bind ?

    As mentioned in comments on the Q, if any of the functions returns a false, it will prevent the event bubbling.

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

Sidebar

Related Questions

I have following databases: test table1 fields: id, password, name, lastname test2 table2 fields:
Say, I have the following :nm <Plug>Ls :ls<CR> :nm <Leader>L <Plug>Ls When I do
I have the following regex meant to test against valid name formats: ^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z
I have a .h file with the following declarations: //////////////////////////////////////////////////////////////////////////////// // Syntek Plug-In Custom
Say, I have the following test: [Test] public void MyTest( [RandomNumbers( Count=100, Minimum=0, Maximum=1000
I wrote this script to change the usb keyboard layout automatically on plug-in import
I have following method in wcf webenabled service Public Person AddPerson(Person p); As of
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have following class public class ButtonChange { private int _buttonState; public void SetButtonState(int
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,

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.