Eurogangster Posted January 17, 2020 Share 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 Link to comment Share on other sites More sharing options...
Mark Topper Posted January 17, 2020 Share Posted January 17, 2020 If it's displayed by default, and that is the issue, add this to the element: style="display:none;" Quote Link to comment Share on other sites More sharing options...
Eurogangster Posted January 17, 2020 Author Share Posted January 17, 2020 in the div ? Quote Link to comment Share on other sites More sharing options...
Mark Topper Posted January 17, 2020 Share Posted January 17, 2020 5 minutes ago, Eurogangster said: in the div ? That is correct, like: <div style="display: none;"> ... </div> 1 Quote Link to comment Share on other sites More sharing options...
Eurogangster Posted January 17, 2020 Author Share Posted January 17, 2020 O my god it was so simple and was searching in js to do that . LoL thanx Mark Quote Link to comment Share on other sites More sharing options...
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.