JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<span>iPhone(800 €)
<input type="checkbox" id="myCheckbox" class="checkbox-product order-product" data-name="iPhone" data-price="800">
</span>
</p>
<br>
<hr>
<div id="show" class="show"></div>
JavaScript
$(function(){
var checkbox = $('#myCheckbox');
var showContainer = $('#show');
checkbox.on('change', function(){
// this fait référence à la checkbox de l'évennement
if($(this).is(':checked')){ // Si la checbox est checkée
var price = 'Price : ' + $(this).attr('data-price'); // On récupère sur l'input les data-attribute, et concaténation en string
var name = 'Name : ' + $(this).attr('data-name');
showContainer.html(name + '<br>' + price);
}else{
showContainer.empty();
}
});
})