$('#postText').on('mouseup', function(e){ $('.oneCheckbox:checked').next().val(getSelectedText()); });