What I looking for is:
var arrinput = $('input[name$="letter"]')
How can I change that from jQuery style to a pure javascript style?
So I want the <input>
tags which name
is ended with "letter".
I changed code a bit... My browser dont support querySelector and FYI I'm using webbrowser component on c# winforms
For modern browsers:
document.querySelector('input[name$=letter]');
will return the first match.
document.querySelectorAll('input[name$=letter]');
will return a list of matches.
I suspect that if you look through the jquery source code, it uses document.querySelector[All]
when it's available.
Try:
var items = document.getElementsByTagName('input');
for (var i=0; i<items.length; i++) {
var item = items[i];
if (/letter$/.test(item.name)) {
item.value = "A letter";
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With