Currently, I am facing an issue where my jQuery and JavaScript code is affecting all instances of messageCase when I only want to target and expand one specific instance. How can I modify my code to achieve this without impacting every occurrence of messageCase?
Additionally, it's important to note that I am working under "use strict" conditions.
$(document).ready(function () {
var aTag = $("div.messageCase").id();
var divTarget = $("div.messageCase")
$(document).click(function (e) {
var target = $(e.target);
if (target.is(aTag)) {
if (divTarget.hasClass("messageCase")) {
// divTarget.removeClass("messageCase");
divTarget.addClass("messageCase messageCaseAnimation");
}
} else {
divTarget.addClass("messageCase");
}
if (!target.is(divTarget))
{
$(divTarget).removeClass("B");
}
});
});
Thank you for your help!