Urgent please!...How to assign value to a variable in jQuery

Hi, I am working on design a blog and I want to do user input validation before their data is post on database, but I find it difficult to get the value for test in if statement, I tried to console.log each jQuerry variable but am getting empty string. someone should help please!!!

$(document).ready(function() {
    var $name =  $('#fullname');
    var $email =  $('#regEmail');
    var $password = $('#regPwrd');
    var $reapeatPassword = $('repeatPwrd');
    var $login = $('loginMail');
    $name = $name.val();
    $email = $email.val();
    $password = $password.val();

        type: 'GET',
        url: 'http://localhost:3000',
        success: function(){


    $('#signUp').on('click', function() {
        //I must Validate form Here
        var $details = {
            name:   $name,
            email:  $email, 
            password:  $password
            type: 'POST',
            url: 'http://localhost:3000/posts',
            data: $details,
            success: function(newUser) {


You are just grabbing empty or initial values.

Get the input values on submit, not just when the document loads. Also, don’t overwrite the element variables with their values, that is just confusing code. You can set the values in the $details object.

thanks for the response,
but can you give me a typical line of code that would grab a value, set it to a jQuery variable declaration and console that variable; Probably from there I will move on having seen an example.

what is this…? I can’t get it

Did you try searching for JavaScript form validation examples?

You know how to get the elements. You also know how to get the values from the elements. You just need to get the values at a point that makes sense. Which isn’t on document load. It can either be when the user types into the input or when the user submits the form.

Events like on input, change and submit would be a good time to get the input element values or form data.