I have a javascript a portion of this is as given below which on clicking an anchor tag with class to_comment will show up text box within div classes mentioned in the js.
$(".to_comment").live("click", function(){
$(this).parents(".activity_content").find(".activity_new_comment").show();
$(this).parents(".activity_content").find(".input_new_comments").click();
$(this).parents(".activity_content").find(".input_new_comments").focus();
return false;
});
I have this simple anchor tag in a page in the slim file as :
= link_to("Comment", "#", :class => "to_comment")
And I have hardcoded the text area to appear in the div tag in a _new.html.slim partial as follows:
.activity_new_comment style="display: block;"
.actor_logo_new_comment style="display: none;"
.activity_content
.actor_name_new_comment style="display: none;"
form#new_commentactivity_22.new_comment accept-charset="UTF-8" action="/comments" data-remote="true" method="post"
div style="margin:0;padding:0;display:inline"
input#comment_owner_id name="comment[owner_id]" type="hidden" value="2"
input#comment__activity_parent_id name="comment[_activity_parent_id]" type="hidden" value="22"
.input_new_comments_container
textarea#comment_text_activity_22.input_new_comments cols="40" name="comment[text]" rows="1" style="color: rgb(102, 102, 102);"
#copy_comment_text_activity_22.copy_new_comment Write a comment...
.activities_comment_btn style="display: none;"
But the hyperlink on clicking doesnt load the text area in the corresponding div tag from the partial. The js file is loading in the browser and a sample alert is also working !!