In order to highlight spacing between Chinese characters I've got this code
function replaceSpaces(){
var segmented = $(this).val().replace(/\s/g, "<span> </span>");
$('#preview').html(segmented);
}
$(document).ready(function(){
$('.tobesegmented').focus(replaceSpaces);
$('.tobesegmented').change(replaceSpaces);
});
however, it does NOT trigger the change when I hit the space bar, only when i add text. Is there a way to trigger the replaceSpaces when a person hit's the space bar?
Bonus: Also, why does " " become "&emsp;"?