Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to access javascript variable in html

<!--
It is impossible to access a JavaScript variable using
HTML. HTML is completely different to JavaScript, it is
a markup language (HTML stands for Hyper Text Markup
Language), meaning it is only used to format or prepare
base content that is displayed.
You could access a global variable from an external
script, however, using an in-line script tag in HTML.
-->
<script src="some_external_script.js" defer></script>
<script defer>
	// if a global variable named some_global_variable
	// was defined by 'some_external_script', it can
	// be accessed here
	console.log(some_global_variable);
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #access #javascript #variable #html
ADD COMMENT
Topic
Name
4+2 =