Logo
First domain ever: Symbolics.com (1985)
  • 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
23 days 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

Oh Boy

Oh Boy

Debugging
195.5M views 4 days ago
Keychron K3 Version 2 QMK 75% Wireless Low-Profile Mechanical Keyboard

Keychron K3 Version 2 QMK 75% Wireless Low-Profile Mechanical Keyboard

Affiliate
$84.00
NordVPN

NordVPN

Sponsored
VPN