Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

2019/10/06

A bare minimum, working HTML + jQuery framework that will be executed automatically upon the completion of page load.

This is a bare minimum, working HTML + jQuery framework that will be executed automatically upon the completion of page load.

index.html

<!DOCTYPE html>

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
        <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> -->
        <!-- script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
    </head>
    
    <body>
    </body>
</html>

<script>

    $(document).ready(function(){
        
        console.log('Hello World');
        alert('Hello Kitty');
      
    });
    
</script>

The Result

2018/02/05

How to get the ID of the clicked button using JavaScript

This post is about how to get the ID of the clicked button using JavaScript.

The Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
    <body>

        <button id="1" onClick="reply_click(this.id)">B1</button>
        <button id="2" onClick="reply_click(this.id)">B2</button>
        <button id="3" onClick="reply_click(this.id)">B3</button>

    <script type="text/javascript">
        function reply_click(clicked_id)
        {
            alert(clicked_id);
        }
    </script>
    </body>
</html>

The Result

Reference:

JavaScript - onClick to get the ID of the clicked button
https://stackoverflow.com/questions/4825295/javascript-onclick-to-get-the-id-of-the-clicked-button

2017/03/27

How to sort multi-dimensional arrays in JavaScript

This is a continuation of my previous post on How to create a line chart using Chart.js and the data parsed from a CSV string using Papa Parse. In the previous post, the x-axis is not in ascending order (see below photo). This post will address this issue by sorting the data in the desired order before making the chart.


How to create a line chart using Chart.js and the data parsed from a CSV string using Papa Parse

This is a quick summary about how to create a line chart using Chart.js and the data parsed from a CSV string using Papa Parse.

2016/12/06

How to get input from check boxes and toggle switches

This post is about how to get the input value from check boxes and toggle switches.

Getting the input from check boxes

2016/11/11

2016/11/10

Notes for JavaScript Tutorial for Beginners - Section 1 to 35

Here I put my notes for section 1 to 35 of the "JavaScript Tutorial for Beginners" on Youtube.

Typical HTML Template

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<!DOCTYPE html>

<html>
 
<head> 
<script>


</script>
</head>

<body>

</body>

</html>