JavaScript is code and not data or a markup language

 It's technically possible to mix up JS with an HTML page, even to the extent of embedding code into specific DOMs as follows:

<button onclick="return confirm('Are you sure you want to remove?');">Remove</button>

While it would technically work, there are some serious drawbacks to this once your code base becomes bigger and the logic complicates. It's best practice not to mix up UI elements with the code, and instead, to separate your JavaScript code either into the <script></script> tag, or ideally into a separate *.js file which is loaded to the web page in the headers, for example:

<!DOCTYPE html>
<html>
<body>
<h2>Mastering Qlik Sense JavaScript</h2>
<button id="examplebutton"></button>
<script>
document.getElementById("examplebutton").onclick=function(){
return confirm('Are you sure you want to remove?');
}
</script>
</body>
</html>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.199.122