Does the selection of the wrapped item not work?

console.log($(".welcome_input")[1].val()) console.log($(".welcome_input").get(0).val()) var a = $(".welcome_input") console.log(a[1].val()) 

Error everywhere

  TypeError: Object #<HTMLInputElement> has no method 'val' 

    1 answer 1

    all right:

    $(".welcome_input")[1] returns not a jQuery object, but a DOM element, which, respectively, does not have a val() method

    you can use the selector : first or the .first () method

     $(".welcome_input:first").val(); $(".welcome_input").first().val() 

    if you need to call on an arbitrary index, use the selector : eq () or .eq () method

    generally use id