Eurogangster Posted January 17, 2020 Posted January 17, 2020 Hello i want to hide/unhide div and i use this code that its working can someone write me the code i need to set default display to none ? $.setDisplay = function (id){ if($("#" + id ).css('display') == 'block'){ $("#" + id ).css('display', 'none'); } else if($("#" + id ).css('display') == 'none'){ $("#" + id ).css('display', 'block'); } } $('*[id^="divheader"]').click(function (){ $.setDisplay($(this).data("id")); }); }); Quote
Mark Topper Posted January 17, 2020 Posted January 17, 2020 If it's displayed by default, and that is the issue, add this to the element: style="display:none;" Quote
Mark Topper Posted January 17, 2020 Posted January 17, 2020 5 minutes ago, Eurogangster said: in the div ? That is correct, like: <div style="display: none;"> ... </div> 1 Quote
Eurogangster Posted January 17, 2020 Author Posted January 17, 2020 O my god it was so simple and was searching in js to do that . LoL thanx Mark Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.