This is my example of my situation, I have a menu that uses the same class and class name printed Wants to
& lt; A href = "#" class = "top" onClick = "test ()" & gt; Home & lt; / A & gt; & Lt; A href = "#" class = "top" onClick = "test ()" & gt; Profile & lt; / A & gt; & Lt; A href = "#" class = "top" onClick = "test ()" & gt; Background & lt; / A & gt;
Here I have tried to create a function but can not work
The expected result will show "top selected"
function testing () {Var getclass = $ (this) .find ('top'); If (getClass == 'top') {Warning (getClass + 'selected'); }}
Something like this:
Lt; A href = "#" class = "up" onClick = "test (this)" & gt; Home & lt; / A & gt;
and then ...
function testing (L) {var className = $ (el) .attr ('class'); Console.log (className); }
No comments:
Post a Comment