javascript - Jquery must be stopped from closing when inside div is clicked -
i have password enter box pops up, , when click anywhere on page, fades out. fades out when try enter password too. kindly appreciated.
$(document).ready(function () { $('.chatmic').click(function () { $(".chatmic").toggleclass("chatmicoff"); }); $('.chatloudspeaker').click(function () { $(".chatloudspeaker").toggleclass("chatloudspeakeroff"); }); $('.adminbox').click(function () { $(".passwordcontainer").toggle(); $(".textbox3").focus(); }); $('.adminbox').click(function () { return false; }); $('.adminbox').click(function () { $('.passwordcontainer').fadein('fast', function () { $(".textbox3").focus(); $(document).one('click', function (e) { $('.passwordcontainer').fadeout('fast'); }); }); }); });
try below code: here working fiddle
$(document).ready(function () { $('.chatmic').click(function () { $(".chatmic").toggleclass("chatmicoff"); }); $('.chatloudspeaker').click(function () { $(".chatloudspeaker").toggleclass("chatloudspeakeroff"); }); $('.adminbox').click(function () { $(".passwordcontainer").toggle(); $(".textbox3").focus(); }); $('.adminbox').click(function () { return false; }); $('.adminbox').click(function () { $('.passwordcontainer').fadein('fast', function () { $(".textbox3").focus(); }); }); $('.passwordcontainer').click(function () { return false; }); $(document).bind('click', function (e) { $('.passwordcontainer').fadeout(''); }); });
Comments
Post a Comment