(Foundation 5) Are floating attributes without = signs in HTML tags same as with equals sign?

71 Views Asked by At

Are the following treated the same in foundation 5?

<nav class="top-bar" data-topbar role="navigation">

<nav class="top-bar" data-topbar="" role="navigation">

I am asking because I am using Scala to produce HTML from the backend. I am not sure if I can use Scala to produce HTML like this <nav class="top-bar" data-topbar role="navigation">

This all kind of stems me looking at this example and seeing that data-topbar doesn't have an ="stuff" http://foundation.zurb.com/docs/components/topbar.html

1

There are 1 best solutions below

2
On

It's a custom attribute, so are you are really saying is it's empty by either doing

data-topbar 

or

 data-topbar=

They are most generally used to for javascript to get values from. Like you could use jquery to do something like

$(".top-bar").attr("data-topbar");

You can checkout more on custom attributes here - https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes