skip to Main Content

$(‘input[type=text]’)

How do I convert this to plain javascript

I’ve been trying to figure this out but no luck

2

Answers


  1. const el = document.querySelector("input[type='text']");
    
    Login or Signup to reply.
  2. You can try this,

    [...document.getElementsByTagName("input")].filter(d => d.type === 'text')
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search