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

  • Home
  • SEARCH
  • 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 7940833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:29:23+00:00 2026-06-03T23:29:23+00:00

I am working on rails 3.2 and using coffeescript too.. I have a doubt

  • 0

I am working on rails 3.2 and using coffeescript too..
I have a doubt in using jquery mobile inside my application
I have a html like

<a href="#" data-item=12 data-status=true class="follow">
  <span class="ui-btn-inner">
    <span class="ui-btn-text">
      Follow
    </span>
  </span>
</a>

In my coffeescript, i am trying to write function on click of this Follow, i am trying to send a ajax call.

when i wrote like

  $("a.follow").unbind('click').bind 'click', (event, data) ->
      event.stopPropagation()
      clickedEl = $(event.target)
      console.log(clickedEl)

Console.log prints span with class “ui-btn-text” at times and span with “ui-btn-inner” at times.

But in my coffeescript function , i need to actually take attributes from a tag. How to proceed with this

  • 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-03T23:29:24+00:00Added an answer on June 3, 2026 at 11:29 pm

    You can use event.currentTarget instead of event.target:

    The current DOM element within the event bubbling phase.

    Demo: http://jsfiddle.net/ambiguous/gdzUC/

    Or event.delegateTarget:

    The element where the currently-called jQuery event handler was attached.

    Demo: http://jsfiddle.net/ambiguous/UhBWM/

    You could also use closest:

    clickedEl = $(this).closest('a')
    

    Demo: http://jsfiddle.net/ambiguous/2LHp3/

    The event.target value is:

    The DOM element that initiated the event.

    In other words, it is the thing that was actually clicked on. The currentTarget and delegateTarget will be the thing that the event is bound to. Using closest is probably overkill for this, you’d usually use that to go up the DOM to an container that holds several items that you’re interacting with.

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

Sidebar

Related Questions

I have a working Rails application on version 2.3.5 - I am using many
I have jquery working on my Rails app using the gem 'jquery-rails' . I
I working on Ruby on Rails application using a PostgreSQL database. I have heard
Currently I am working on project like web analytic using rails 3.2.3 I have
I'm using Rails with jQuery, and I'm working on a page for a simple
i am working on rails 3 and using acts_as_taggable_on gem I have blog,Article associated
I have a perfectly working rails application including devise authentication. I created a second
I'm using Rails 3 and Devise for authentication. I have a proper working devise
We are a startup working on an application and we are using Rails 3
I am working on the billing component of a Ruby on Rails application using

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.