Logo
HTTP 418: I'm a teapot. Yes, really.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Getattribute Memes

Posts tagged with Getattribute

JS Get Attribute Has One Of The Worst Return Values

Javascript Programming Debugging Frontend Webdev
1 month ago 2.3M views 0 shares
JS Get Attribute Has One Of The Worst Return Values
So you want to check if an HTML element has an attribute? Simple boolean check, right? Wrong. getAttribute() returns either the attribute's string value or null . But here's the kicker: if the attribute exists and is set to the string "false" , it returns... the string "false" , which is truthy in JavaScript. So when you do if (element.getAttribute("disabled")) , and the attribute is literally set to disabled="false" , congratulations, your condition evaluates to true. Because the string "false" is truthy. JavaScript gonna JavaScript. Fun fact: Use hasAttribute() instead if you actually want a boolean. Or just keep debugging why your disabled button isn't disabled.

Today's picks

Funny World's Okayest Web Developer T-Shirt

Funny World's Okayest Web Developer T-Shirt

Affiliate
$17.99
If your mom was a class

If your mom was a class

Programming
95.5K views 4 years ago
NordVPN

NordVPN

Sponsored
VPN