0

I tried with console log with some JavaScript but I didn't get success. such as

console.log(document.getElementsByTagName('input')[0].attributes[0])
Raman Kumar
  • 131
  • 8
  • 1
    Maybe this [one](https://stackoverflow.com/questions/2664045/how-to-get-an-html-elements-style-values-in-javascript) can help? – standby954 Mar 23 '18 at 07:47
  • 1
    Possible duplicate of [Get a CSS value with JavaScript](https://stackoverflow.com/questions/6338217/get-a-css-value-with-javascript) – Vega Mar 23 '18 at 07:49

1 Answers1

0

Please check the following:

<html>

<body>
<input id = "text1" type ="text"/>
</body>

<script>
function dumpCSSText(element){
  var s = '';
  var o = window.getComputedStyle(element);
  for(var i = 0; i < o.length; i++){
    s+=o[i] + ':' + o.getPropertyValue(o[i])+';';
  }
  return s;
}
console.log(dumpCSSText(document.getElementById("text1")));
</script>
</html>
I. Ahmed
  • 2,438
  • 1
  • 12
  • 29