jQuery get input value problem

jQuery get input value problem

Hi, i have one question. Why i can't get input value from ready function...?
$(document).ready(function () {
    
    var idOfForm = $('#input-text-value-what-i-need').val(); 
    alert(idOfForm); // return empty(Alert box is empty).
    var finalId  = 'form-id-'+idOfForm;
    var aa = '#'+finalId+'1';
    alert(aa); // return #form-id-(and here i need input value ).
    $(aa).submit(function(e){
        e.preventDefault();
         dataString = $(aa).serialize();
         $.ajax({
...

...

}