JSFiddle - React, Tailwind, and code Playground
HTML
<div id='button-1-remove'>1</div>
<div id='button-2-remove'>2</div>
<div id='button-3-remove'>3</div>
<div id='button-4-remove'>4</div>
<div id='button-5-remove'>5</div>
<span id="output"/>
CSS
div {
width:30px;
padding:4px;
margin:4px;
background-color: green;
color:white;
}
JavaScript
//button id starts with
$("[id^=button-]").click(function () {
//log($(this).html()+' starts with');
});
//button id starts with and ends with
$("[id^=button-][id$=-remove]").click(function () {
log($(this).html()+'starts with button- and ends with -remove');
});
//button id contains
$("[id*=-remove]").click(function () {
//log($(this).html()+' contains');
});
function log(text){
$('#output').append(text)
$('#output').append($('<br/>'));
}