JSFiddle - React, Tailwind, and code Playground
HTML
<input class="input" placeholder="message"/>
<ul>
</ul>
JavaScript
$(document).on('keyup', '.input', function(e) {
var message = $(this).val();
const projeto_id = '1234'
if (e.keyCode == 13 && message != '' && projeto_id != '') {
// $(this).val('') // << isso define o campo como uma string vazia
var dataStr = "&message=" + message + '&projectId=' + projeto_id;
$('ul').text(dataStr);
}
})