Created
September 8, 2011 11:10
-
-
Save varnie/1203161 to your computer and use it in GitHub Desktop.
an example of changing a style of td using JQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>getElementById example</title> | |
<style> | |
table .c { color: red } | |
.a.c {color: green} | |
</style> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
var everyFirstTd = $("#t tr td:first"); | |
$("button").click(function() { | |
everyFirstTd.toggleClass("a"); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<table id="t"> | |
<tr> | |
<td class="c">Текст</td> | |
</tr> | |
</table> | |
<button>change</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment