Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access a property of an html element?

Tags:

javascript

dom

I'm trying to get the "validacion" property of an HTML element.

console.log (element[0]);

This returns me:

enter image description here

<input class="estilo_input_text ng-pristine ng-untouched ng-valid ng-empty" id="asunto" name="asunto" ng-model="asunto" placeholder="Asunto" type="text" validacion="required">

How can I access the "validacion" property?

like image 688
yavg Avatar asked Nov 01 '25 14:11

yavg


1 Answers

You need the javascript Element.getAttribute() method:

console.log(element[0].getAttribute("validacion"));
like image 108
Danny Fardy Jhonston Bermúdez Avatar answered Nov 03 '25 04:11

Danny Fardy Jhonston Bermúdez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!