php - onclick change css -
i making simple calendar app in php , want change <td>
block style depending on user does. want when "menuclick" class on, other classes stop working until click block. previous block should turned off well. in advance.
echo'<td onclick=classname="menuclick"; onmouseover=classname="menuon"; onmouseout=classname="menuoff";>' . $countday++ . "</td>"
i think can achieve want using following:
echo '<td onclick="this.classname=\'menuclick\';" onmouseover="this.classname=\'menuon\';" onmouseout="this.classname=\'menuoff\';">'
seeing though giving jquery answer , jbabey complaining inline js:
$('td').each(function() { $(this).mouseenter(function() { $(this).removeclass().addclass('menuon'); }); $(this).mouseleave(function() { $(this).removeclass().addclass('menuoff'); }); $(this).click(function() { $(this).removeclass().addclass('menuclick'); }); });
Comments
Post a Comment