JSFiddle - React, Tailwind, and code Playground

HTML

<div class="item" data-value="1">item</div>

JavaScript

$('.item[data-value="1"]').data('value', '2');

$('.item').filter(function() {
   return $(this).data('value') == 2;
}).text('selected');