Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to find all Input elements that have a specific value?

How to find all Input elements that have a specific value, e.g. "ABC" ?
Both the JavaScript and its jQuery equivalent do not return any elements.

document.querySelectorAll('input[value="ABC"]'); 

$('input[value="ABC"]'); // .length is 0

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If the inputs value was set by js or the user you have to check the inputs’ value property and I don’t believe there is a way to do that with a css selector.
You’ll have to use good ole js

var $abc = $('input').filter((i,v) => v.value === "ABC");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading