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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:56:39+00:00 2026-05-26T22:56:39+00:00

I am trying to make a similar behavior as the comment link on a

  • 0

I am trying to make a similar behavior as the comment link on a question in Stack Overflow.
A click should hide the div containing the “Add comment” link and show another div containing the form for a new comment.

How is it possible to do that with coffeescript ?

I am trying the following that does not work :

jQuery ->

  hide_comment_link = () ->
    $('#add_comment_link').hide
  hide_comment = () ->
    $('#add_comment').hide
  show_comment = () ->
    $('#add_comment').show

  $('#add_comment_link').click ->
    hide_comment_link
    show_comment
    false

View is :

#add_comment_link
  #{link_to "Add a comment"}
#add_comment
  Add a comment in this div.
  • 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-26T22:56:39+00:00Added an answer on May 26, 2026 at 10:56 pm

    Unlike Ruby, CoffeeScript doesn’t allow you to omit parentheses from function/method calls if there are no arguments. You need to add them:

    $('#add_comment_link').hide()
    
    hide_comment_link()
    

    The do keyword is another option:

    do $('#add_comment_link').hide
    
    do hide_comment_link
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a behavior had a ConditionCollection similar to MultiDataTrigger. I've looked
Im trying to make something similar to twitpic.com's email submission feature. Their address schema
Is there anything similar to getElementById in actionscript? I'm trying to make a prototype
Trying to make a make generic select control that I can dynamically add elements
So I'm trying to make an incrementer similar to this: http://www.usagain.com/ but I'm apparently
I am trying to make a jquery similar tabs. since its for single use
I'm trying to make a user control similar to the Windows Vista/7 breadcrumb bar
I'm trying to make linked list similar too the one here: linked list in
Im trying to make my own calendar similar to iCal and all is going
I'm trying to make an application very similar to the iCal app on 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.