March 3, 2013
Dynamically Replacing Content with Javascript and Links
Question by Kristopher Perovic
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'>
</script>
<script type='text/javascript'>
$(document).ready(function () {
$('.fieldreplace a').click(function () {
$('#fieldmatch, .fieldgame').hide();
var region = $(this).data('region');
$('#' + region).show();
});
});
</script>
I’m trying to make it so clicking one link will replace content in all the cells, and not, as it is, in just one cell.
Help?
Answer by Starx
You can replace the contends of all td
s like?
$('#tableId td').html('content to update on all cells');