Frage

How can I make it more easier?

$("#one").click(function() { $("#container").fadeOut(200); }); $("#two").click(function() { $("#container").fadeOut(200); }); $("#three").click(function() { $("#container").fadeOut(200); }); $("#four").click(function() { $("#container").fadeOut(200); });

War es hilfreich?

Lösung

Either add class to each element .class

$('.class').click(function () {
    $("#container").fadeOut(200);
});

or combine the ids to the selector

$('#one,#two,#three,#four').click(function () {
    $("#container").fadeOut(200);
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top