相当于jQuery中$('input [name$=“value”]')的Javascript如何写?
Sonder
2020-05-08
340字
1分钟
浏览 (2.4k)
How can I get an input element whose name attribute ends with a particular value using just javascript?
I found this $('input[name$="value"]')
method available in jQuery.
Is there a function like that available in javascript? I cannot use jQuery for some reason.
Answers:
var elements = document.querySelectorAll('input[name$="value"]');