I have a simple span like so
Remove
This span is within a table, each row has a remo
If you insist on using old-school HTML 4.01 or XHTML:
$('.removeAction').click(function() {
// Don’t do anything crazy like `$(this).attr('id')`.
// You can get the `id` attribute value by simply accessing the property:
this.id;
// If you’re prefixing it with 'my' to validate as HTML 4.01, you can get just the ID like this:
this.id.replace('my', '');
});
By the way, in HTML5, the id attribute can start with a number or even be a number.
Then again, if you’re using HTML5 anyway, you’re probably better off using custom data attributes, like so:
Remove