mercredi 13 février 2019

Jquiry cant find "this" within a if statement

I am using jquiry and wanted to use an if statement to determine the width of a span and if it's larger than x with add a class to the same object

if ($(".tool-tip").width() > 300) {
$(this).addClass("full-width")
}

I expected "this" to apply a class of full-with to the class of tool-top

Aucun commentaire:

Enregistrer un commentaire