Appending a DOM element twice (jQuery)

后端 未结 5 1912
走了就别回头了
走了就别回头了 2021-02-19 22:39

Can someone explain why the following snippet does not add to both #a and #b?

HTML:

5条回答
  •  一整个雨季
    2021-02-19 23:06

    I tried a trick and it worked. I just nested the function of one button click in another. i mean I am changing the parent every time to avoid this issue. the main thing is that when i am writing the click function for button1 click the button2 logic is written under that and the button3 click logic is written inside button2 click method like a hierarchy. Just see the code. you will get it.

    
    
      
        
        
        
    
        
        
    
        Hello, world!
      
      
        

    DOM Element Inserting!

提交回复
热议问题