How to change HTML <p> tag content with JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
  
<head>
</head>
  
<body>

<p id="p-id"></p>

<script>        

function set_p(text) 
{
    document.getElementById('p-id').innerHTML = text;
}

set_p("p tag text")

/*
run:
  
"p tag text" text in "p-id"
    
*/

</script>
</body>
</html>

 



answered Jul 31, 2015 by avibootz

Related questions

...