jquery - Find tags with no classes and add a class -
i need jquery add class form element has no class allready. made function, hasnoclass.
is possible in real life? pseudo code: add class "classless" form tag jquery("form").hasnoclass().addclass("gotclass");
alternatively can done "add class 3rd form start tag on page. no clue how either, there may position or count function pseudo code: add class third form tag: jquery("form").postition("3").addclass("gotclass");
wow! 2 questions! need 1 answer on both appreciated sake of knowing , maybe future use.
br. anders
this should do:
$('*:not([class])')
you'd able do
$('*:not([class])').addclass('gotclass');
or
$('*:not([class])').eq(3).addclass('gotclass');
to clarify: selector matches elements, *
, not
within scope: "any element attribute, [
,]
, class
"
Comments
Post a Comment