Sign up and we'll send you the best freelance opportunities straight to
your inbox.
We're building the largest freelancing marketplace for people like you.
A custom data-speaker attribute on a <blockquote> tag.
The attribute value is not visible, but is readable by JavaScript.
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
-- President Kennedy, 1961, Inaugural address
<acticle>
<blockquote data-speaker="John F. Kennedy">
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
</blockquote>
-- President Kennedy, 1961, Inaugural address
</article>
A custom data-location attribute on a <blockquote> tag.
Clicking the button will display the location value.
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
-- President Kennedy, 1961, Inaugural address.
<article>
<blockquote data-location="Washington, DC" id="kennedyquote">
And so, my fellow Americans: ask not what your country
can do for you – ask what you can do for your country.
My fellow citizens of the world: ask not what America
will do for you, but what together we can do for the
freedom of man.
</blockquote>
-- President Kennedy, 1961, Inaugural address.
</article>
<br /><br />
<button onclick="show();">Show data</button>
<script>
let show = () => {
let element = document.getElementById("kennedyquote");
alert("Location = " + element.getAttribute('data-location'));
}
</script>
Code explanation
The <blockquote> tag below contains the data-location attribute.
The data-location attribute specifies the location where the speach was delivered.
Clicks are handled by the onclick event.
Onclick invokes a JavaScript function that extracts and displays the location of the quotation.
Note: Notice that the location displays quickly without server call delay.
Sign up and we'll send you the best freelance opportunities straight to
your inbox.
We're building the largest freelancing marketplace for people like you.