How to get an element whose name value is a variable in the a tag

$("a [name = "str"]")
quotation marks str is an element that finds that name is str. I want to write the value of a variable.

Jun.22,2021

var name = 'str';
$("a[name=" + name + "]")
Menu