Javascript checking HTML element type

/ Published in: JavaScript
Save to your folder(s)

How to check Html element type

Copy this code and paste it in your HTML
  1. var htmlElement = ...// html element
  2. var type = "input"; // type
  3. if(htmlElement.nodeName.toUpperCase() == type.toUpperCase())
  4. {
  5. //do something
  6. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.