All id's are unique, but empty strings are always returned, I tried without jquery, everything is the same: there are empty strings in the variables, but try to find out the value through the console, then everything works.
Answer # 1
Of course, empty values will be returned, but you don't have anything entered at the time of code execution.
And by the way, the input is spelled differently:
<input id="ttl"></input> ^^^^^^^^ no need
<input id="ttl" type="text"> ^^^^^^^^^ desirable