In this this jQuery script I’d like to grab the id for $("#rowDate1") dynamically:
<script>
$(function() {
$("#rowDate1").click(function() {
var thetext = $(this).html();
$(this).html('<input type="text" name="edittext" id="edittext" value="'+thetext+'" />');
});
});
</script>
I’m making an inline editable table, and I only want to allow the user to click on <td>‘s with an id. How can I do this and only allow the <td> ids to be clickable?
EDIT – HTML added:
<td id="rowDate1">09/10/12 - 09/14/12</td>
You can use
attribute starts withselector: