Return the word spacing of a <p> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:wordSpacing

Description

Return the word spacing of a <p> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="word-spacing:10px;">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Return word spacing of p</button>

<script>
function myFunction() {//from   ww w .  j  av a  2s. com
    console.log(document.getElementById("myP").style.wordSpacing);
}
</script>

</body>
</html>

Related Tutorials