Saturday, 8 July 2017

set and get the innerHTML of the Label and DIV control using jQuery or JavaScript


<html>
<head>
    <title></title>
    <head>
        <script type="text/javascript" src="jquery1.8.3-min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript">
            // get and set using jquery
            $(document).ready(function () {

                $("#jq1").html("Div is Fill.");
                var title = $('#jq1').html();
                alert(title);

                // get and set using javascript
                // Get the text content:

                alert(document.getElementById("je1").textContent);
                // Set the text content:
                document.getElementById("je1").textContent = "This is text";
            });

          
        </script>
    </head>
    <body>
        <div id="jq1">
            jQuery DIV
        </div>
        <div id="je1">
            JavaScript DIV
        </div>
    </body>
</html>

No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...