As you've discovered, the dash (text-muted div) appears because the field is marked as read-only. This is done by some JavaScript included as part of the Portal product. It will only add that the dash if your input is read only and has no value when the code is run.
If I had to guess, you're not putting your code that sets it to read only in a $(document).ready. This means your code is running before the code that handles the read-only functionality.
So you've got a couple options:
1. Set the value of the input before you set it as read only.
2. If you don't want that out of the box functionality, set it to be read only after that logic has already run by putting your code in a $(document).ready() like so:
$(document).ready(function() {
$("#serialnumber").attr("readonly", true);
});
Then, when the out of the box code runs, the field won't be read only yet, and the text-muted div won't be added.
Hope that helps.
Nick