Saturday, 1 September 2018

Javascript : .innerHtml & .textContent


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 <span id="mangsa">Dokument syarikat</span>
            
  
    <script>
        var kuliPencuri = document.getElementById("mangsa");

        var bosPencuri = function() {

            kuliPencuri.innerHTML = `<b>Dokument syarikat</b>`;
            
        };

        kuliPencuri.addEventListener("click", bosPencuri);

        
        </script>
..

This will show result as HTML render.




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 <span id="mangsa">Dokument syarikat</span>
            
  
    <script>
        var kuliPencuri = document.getElementById("mangsa");

        var bosPencuri = function() {

            kuliPencuri.textContent = "Dokument Palsu";
            
        };

        kuliPencuri.addEventListener("click", bosPencuri);

        
        </script>
..

This will show raw HTML not rendered

http://xahlee.info/js/js_textContent_innerHTML_innerText_nodeValue.html

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...