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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:43:32+00:00 2026-05-25T06:43:32+00:00

So yeah as the title says, whenever I supply an onclick parameter to my

  • 0

So yeah as the title says, whenever I supply an onclick parameter to my link, it processes the resulting action as HTML in place of JS. Any ideas?

link_to "/profile/share?id=#{post.id}", :id => "share_#{post.id}", :remote => true do "stuff" end

link_to "/profile/share?id=#{post.id}", :onclick => "javascript:$('#share_#{post.id}').text('Loading...')", :id => "share_#{post.id}", :remote => true do "stuff" end
  • 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-25T06:43:32+00:00Added an answer on May 25, 2026 at 6:43 am

    You could have a separate script that binds your custom event handler:

    $('a.share-link').click(function() {
        $(this).text('Loading...');
    });
    

    You’ll need to add the ‘.share-link’ class to all the links you want to act like that, but once you’ve done that it should work like you want. This method will have jQuery (which I assume you’re using, from your code sample) bind the event handler, leaving the ‘onclick’ attribute free for Rails to use for AJAX purposes.

    Hope this helps!

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

Sidebar

Related Questions

Yeah. As the title says, I am tasked with creating custom field in user
My code works (yeah!) which sends json to a server.. would appreciate any thoughts
Yeah, kind of random, but I was wondering if anyone could link me to
index.html <link href=Styles/bootstrap.css rel=stylesheet /> <script data-main=Scripts/app src=Scripts/require.js></script> <a class=btn0>button 0</a> <div class=target></div> app.js
Yeah, its a long and convoluted title... sorry. I am working in VBScript in
yeah, because GWT not support java.text.Collator (and java.util.Locale also) ;/ Any solutions?
Yeah, the title can scare babies, but it's actually quite straightforward. I am trying
Yeah, I know. Long title of question... So I have class name in string.
Yeah, kinda dumb title, but I found it hard to describe my problem. I
Yeah, its a bit on this side of pointless, but I was wondering... I've

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.