jquery - Cannot remove a class hidden by JavaScript -
I would like to hide a div when it is loaded and when a button is clicked, what do I get Div only shows for a short time and then hides it whether I am doing it correctly with the CSS class or what You need to use the default action of your anchor to stop: < / P> display: none; ?
HTML
& Lt; Div id = "message" & gt; & Lt; Div class = "hide item-user" & gt; & Lt; A href = "" & gt; Some & lt; / A & gt; & Lt; / Div & gt; & Lt; One class = "btn-user" href = "" & gt; Button & lt; / A & gt; & Lt; / Div & gt;
CSS
.hid {display: none; }
JS
& lt; Script & gt; // jquery has already been loaded $ (document) .ready (function () {$ ('# message .btn-user') click (function () {$ ('# message .item-user') RemoveClass ('hidden');});}); & Lt; / Script & gt;
$ ('# message .btn-user'). Click (function (e) {e.preventDefault (); $ ('# message .item-user'). RemoveClass ('hid');});
Comments
Post a Comment