Example 1 — Official Demo: input[name$="letter"]
Find inputs whose name ends with letter, then set a new value.
$("input[name$='letter']").val("a letter");
var names = $("input[name$='letter']").map(function () {
return this.name;
}).get().join(", ");
console.log(names);
// newsletter, loveletter How It Works
- Limit to inputs. The
inputtag keeps the search on form controls. - Apply $=. Only names that end with
lettermatch. - Skip mid-word hits.
letterboxcontainsletterbut does not end with it.

