combine jQuery statements -
i'm having brain dead kind of day , i'm trying figure out way make smaller , i've tried has not worked. know there has better way figured ask here.
any tips on jquery caching great (i'm trying make 225 lines of jquery small possible can help!
$(".tablemap td:nth-child(1)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(2)").css("text-align","center").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(3)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(4)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(5)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(6)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(7)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(8)").attr("style","border-right:1px solid black; border-bottom:1px solid black;"); $(".tablemap td:nth-child(9)").css("text-align","center").attr("style","border-bottom:1px solid black;");
sorry horrendous code, feel free give me tips can think of!
jeff
just apply css class border styles of cells (no jquery needed @ that):
<style> .tablemap td { border: 1px solid black; border-left: none; border-top: none; } </style>
then, afterwards, can apply specific styles 2 items needed:
$(".tablemap td:nth-child(2)").css("text-align","center"); $(".tablemap td:nth-child(9)").css("text-align","center").attr("style","border-right:none;");
a thing remember use javascript/jquery when need it. use straight html/css whenever can, site perform better way.
Comments
Post a Comment