jquery get value of input by name code example

Example 1: jquery input name value

var target = $('input[name="hoge"]').val();

Example 2: name selector jquery

$('td[name ="tcol1"]')   // matches exactly 'tcol1'
$('td[name^="tcol"]' )   // matches those that begin with 'tcol'
$('td[name$="tcol"]' )   // matches those that end with 'tcol'
$('td[name*="tcol"]' )   // matches those that contain 'tcol'

Example 3: jquery get value by name

$("input[name=nameGoesHere]").val();

Example 4: javascript jquery get form field value

$(document).ready(function(){
         
             $("#buttonSet").click(function () {
                 $("#txtBox").val("Amit");
                 $("input:radio").val(["male"]);
                 $("#buttonGet").removeAttr('disabled');
            });
             $("#buttonGet").click(function () {
                $("#result").html(
                    $("#txtBox").val() + "<br/>" +
                    $("input:radio[name=rd]:checked").val()
                );
            });
         });