javascript - Clicking on One Button Cancels a Click Event of Another (Outer) Button in jQuery -
 I have a post that allows users to comment, but the comment's    HTML :     jQuery :    Cancel     You are hiding      Note: You have two choices for a selector  textarea  default Comments are hidden from the user  comment  button in the comment texture  send  and  cancel  buttons are  cancel  Hides the button  textarea , but after that, clicking on the  comment  button does not work until F you do not refresh the page.   & lt; Div class = 'post' & gt; & Lt; Div class = 'p_body' & gt; & Lt; Div class = 'comment_body_wrapper' & gt; & Lt; Div class = 'comment_wrapper' & gt; & Lt; Textarea class = "comment_content" rows = '2' maxlength = "480" name = "comment_content" placeholder = "your thoughts on this ..." & gt; & Lt; / Textarea & gt; & Lt; Div class = 'comment_buttons_wrapper' & gt; & Lt; Div class = 'comment_buttons' & gt; & Lt; Button class = "submit_comment btn" type = "submit" & gt; Send & lt; / Button & gt; & Lt; Button class = "comment_cancel_button btn" type = "submit" & gt; Cancel & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = 'post_footer' & gt; & Lt; Button class = 'btn post_comment' value = '1' & gt; Comment & lt; / Button & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;    
 $ ('body'). ('Click', '.post_comment', function) {var $ this = $ (this); Var $ comment = $ this.closest ('.post'). ('. Comment_body_wrapper'). Find ('. Comment_wrapper'); $ Comment.slideToggle (); $ ('Click', '.comment_cancel_button', function () {var $ this = $ (this); $ at this; if I click on the  comment  button it ensures Click on toggle (display or hide) it. (Click.);)     removes this event  Comment_cancel_button  hidden  comment_wrapper  is required but after clicking on it does not  comment   slideToggle  s is not it refreshing me I have How can I manage it correctly?    '. Comment_body_wrapper ', but your child is showing ' comment_wrapper ' :)   
 $ (document) .on ( 'Click', '. Post_comment', function () {console.log ('.post_comment'); var $ this = $ (this); var $ comment = $ this.closest ('. Post'). (' Comment_body_wrapper .comment_wrapper '); $ Comment.slideToggle (); $ comment.find ('. Comment_content ') Focus ();}); $ (Document) .on ('click', '.comment_cancel_button', function () {var $ this = $ (this); $ this.closest ('. Comment_body_wrapper'). ('. Comment_wrapper').); });   . Find out ('. Comment_body_wrapper .comment_wrapper')    
 
  
Comments
Post a Comment