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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:49:45+00:00 2026-05-21T07:49:45+00:00

I have this link : <a href=# onClick=addSide(‘1’);return false>Link</a> and I want that, when

  • 0

I have this link :

<a href="#" onClick="addSide('1');return false">Link</a>

and I want that, when I click on a button (for example), the value of addSide in that link grow. Such as first click on the button I want to pass to the addSide function 1, second click
addSide(‘2’), and so on…

So, is it possible change value of the addSide function, trought jQuery, by editing this and replace with somethings like addSide('another_value')?

EDIT
I see is not so clear my question. So I give an example 🙂

This is the code I want to edit :

<div class="trackon" id="trackline">
    <span class="trackbotton1">
        <a class="lblueb" href="#" onClick="addSide('');return false">Add Side</a>
    </span>
</div>

I wrote this :

$('#trackline').find('.trackbotton1').children().attr('onclick', 'alert("example");return false');

but the function doesnt change…

  • 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-21T07:49:46+00:00Added an answer on May 21, 2026 at 7:49 am

    Edit This is based on Jimmy Sawczuk’s approach, and it works.

    HTML

    <a href="#" id="link" onclick="addSide();return false" rel="1">Link</a>
    <button id="button">Button</button>
    <div id="slide">1</div>
    

    JS

    $('#button').click(function() {
     var current_num = parseInt($('#link').attr('rel'));
     var new_num = current_num + 1;
     $('#link').attr('rel', new_num);
    });
    
    function addSide() {
        var n = parseInt($('#link').attr('rel'));
        $('#slide').text('slide number ' + n );
    }
    

    Old answer – This doesn’t work.

    <a href="#" id="link" onclick="addSide('1');return false">Link</a>
    <button id="button">Button</button>
    
    $('#button').click(function() {
     var current_func = $('#link').attr('onclick');
     var current_func_parts  = current_func.split("'");
     var current_num = parseInt(current_func_parts[1]);
     var new_num = current_num + 1;
     var new_func = "addSide('" + new_num + "');return false";
     $('#link').attr('onclick', new_func);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my page: <a href onClick=return false;>Press me!</a> The link
I have the javascript code for a link click: document.getElementById('giddy').onclick = function { alert(this.href);
I want this link to have a JavaScript dialog that asks the user Are
I have this code in the end of link button click: Response.ContentType = application/zip;
I have a href element and that has onclick event on it. I want
I have this href link with text either attivo or non attivo User can
i have this code: $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() {
I have this link in my Struts2 app: <a href=/MyApp/My.action?w=%E8%A8%80%E8%91%89&key=6f98f58ce>Link</a> %E8%A8%80%E8%91%89 is shown as
I have this link: <a href=data:application/pdf;base64,JVBERi0x...KJSVFT0YK>PDF</a> In Safari on MacOsX, clicking the link instantly
I have this code that creates links. /* Create a link to activate the

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.