vendredi 20 février 2015

How to hide elements when another element is clicked


Having a bit of difficulty getting this jquery to work. I have a form where all fields are nested in a div.form-group. The subscribe button has an id of subscribe.


I want the form fields to disappear on click... but my js is not working out. Here's what I've tried, to no avail:



(function($) {
window.onload = function () {
$("#subscribe").click(function() {
$(".form-group").css("display: none");
});
}
})(jQuery);


The form-group class is set to display: block in the CSS.


Is there something obvious I'm missing here? Any help is greatly appreciated.


cheers,





Aucun commentaire:

Enregistrer un commentaire