img

相当于jQuery中$('input [name$=“value”]')的Javascript如何写?

2020-05-08 0条评论 2.2k次阅读 JavaScript


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"]');
🏷️ #jq#input

💬 COMMENT


🦄 支持markdown语法

👋友