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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:08:13+00:00 2026-05-28T07:08:13+00:00

I have html output in paging section like this; <p>&nbsp;<strong class=active>1</strong>&nbsp;<a href=http://localhost/project/report_nc/search_now/1>2</a>&nbsp;<a href=http://localhost/project/report_nc/search_now/2>3</a>&nbsp;<a href=http://localhost/project/report_nc/search_now/1>Next

  • 0

I have html output in paging section like this;

<p>&nbsp;<strong class="active">1</strong>&nbsp;<a href="http://localhost/project/report_nc/search_now/1">2</a>&nbsp;<a href="http://localhost/project/report_nc/search_now/2">3</a>&nbsp;<a href="http://localhost/project/report_nc/search_now/1">Next »</a>&nbsp;</p>

Now i need to add attribute “onclick” using jquery. BUt unfortunately “onclick” attribute cannot be set with jquery. At the same time i came up with an idea : taking a single anchor tag (i.e. <a href="http://localhost/project/report_nc/search_now/2"></a>) and replace it by a new anchor tag (i.e. <a href="javascript:void(0)" onclick="myFunction(2)"></a>).

How would i do it with jquery? The idea is to post the form while clicking on the paging links.

SOLVED !

Thank you all for your kind responses……I guess there was a minor mistake in my code; as i was looking through the code posted by umesh i noticed “onClick“…yes i was using “onclick” instead of “onClick“. Now it has worked in FF and hopefully it will work in IE too.

  • 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-28T07:08:14+00:00Added an answer on May 28, 2026 at 7:08 am

    Value of the anchor can be used to pass the value to function myFunction. If Anchor doesn’t contain any value, don’t do anything.

    Working Test code as below:

    <html>
        <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
        $(document).ready(function(){
        // Use Proper anchor selector on your page 
         $("a").each(function(){
           var no=$(this).html();
           if(!isNaN(parseInt(no))){
                $(this).attr("onClick","myFunction("+no+")");
                $(this).attr("href","javascript:void(0)");
          }
          });
        });
        </script>
        </head>
        <body>
        <p>&nbsp;
        <strong class="active">1</strong>&
        nbsp;
        <a href="http://localhost/project/report_nc/search_now/1">2</a>&nbsp;
        <a href="http://localhost/project/report_nc/search_now/2">3</a>&nbsp;
        <a href="http://localhost/project/report_nc/search_now/1">Next »</a>&nbsp;
        </p>
        </body>
        </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have HTML that looks like this: <p> May 4 - <a href=http://auburn.craigslist.org/web/2996976345.html>residual
Often when writing PHP I'll have it output some HTML like this - echo
I have html code like this <tr class=odd> <td><b>Reason for Termination:</b></td> <td>this has bunch
Basically I have a html output in the format: <div class=qtip-content>http://www.urlgoeshere.com/image.jpg</div> What I want
I have menu generated by a CMS with HTML output like: <ul id=category-nav> <li>
hi i have HTML content like: <div id=j_idt33:summary> <ul id=j_idt33:summary2 class=summary> <li style=margin-right: 85%;
I have this working fine from Linux command line: wkhtmltopdf entry.html output.pdf But the
I have HTML that looks like this: <form id=kinodForm> <input type=text name=element[5] value=krispy kreme
Edit: This HTML is output from a Flash application & its badly formed because
I have some html that is created/output from a flash application & I need

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.