How do you use $(this)
with a JS function and then find the attr
?
function date_box() {
alert(this.getAttribute(week));
}
I want to get the attribute week
from an element called gospel_table
4. On click of gospel_table4
, the function is triggered:
<a href='#'><div id='gospel_table4' week='$one_date' onclick='date_box()'> Week $one_date </div></a>
I can't do this:
$(this).click...
Because only one element of gospel_table4
is clickable. With the other method, all the elements of gospel_table4
are clickable.
Basicially, how do I get the attr from the function of date_box()?