jquery - click of the element starting with prefix

JavaScript
voted: 0
vote
event prefix click element

Click of the element starting with prefix.

<div id="expression_part_17" class="badge" style="background-color: red"> + </div>
<div id="expression_part_19" class="badge" style="background-color: red"> - </div>
<div id="expression_part_20" class="badge" style="background-color: red"> * </div>
<div id="expression_part_21" class="badge" style="background-color: red"> / </div>

$(document).on('click', '[id^="expression_part_"]', function (e) {
                var partId = $(this).prop("id").replace(/[^\d]/g, '');
    });
working url: not entered
version: not entered
Leave a Comment:
Characters left:
No comments yet.