javascript - Closing a div when clicking on a button which is inside of the same div -


make simple answer unable me make work... title says maybe can me out.

_doc.on('click','.settings',function() {     $('.icon-bar').fadein(200); });  _doc.on('click','.close_btn',function(e) {     $('.icon-bar').hide(e.currenttarget.id);     $('.icon-bar').fadeout(200); }); 

the button opens called 'settings' , 1 should closing div called 'close_btn'.

let me try explain. when user clicks on button our event trigger

_doc.on('click','.close_btn',function(e) {  }); 

here can use closest()

_doc.on('click','.close_btn',function(e) {    jquery(this).closest('div').hide(); }); 

if want use class selector

_doc.on('click','.close_btn',function(e) {    jquery(this).closest('.parent_div').hide(); }); 

it hide button , parent element class="parent_div". let me know if more explanation needed.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -