static/publish.js
// Add a <p> listing word count below the <textarea> in a <section>.
Add a  listing word count below the  in a .
Add a listing word count below the in a .
function addWordCount (sectionID) {
  var section = document.getElementById(sectionID)
  var textarea = section.getElementsByTagName('textarea')[0]
  var wordCount = document.createElement('p')
  wordCount.className = 'wordCount'
  section.appendChild(wordCount)
  textarea.addEventListener('keyup', updateCount)
  textarea.addEventListener('paste', updateCount)
  updateCount()
  function updateCount () {
    var count = countWords(textarea)
    wordCount.innerHTML = count === 1 ? '1 word' : count + ' words'
  }
}
function addWordCount ( sectionID ) { var section = document . getElementById ( sectionID ) var textarea = section . getElementsByTagName ( 'textarea' ) [ 0 ] var wordCount = document . createElement ( 'p' ) wordCount . className = 'wordCount' section . appendChild ( wordCount ) textarea . addEventListener ( 'keyup' , updateCount ) textarea . addEventListener ( 'paste' , updateCount ) updateCount ( ) function updateCount ( ) { var count = countWords ( textarea ) wordCount . innerHTML = count === 1 ? '1 word' : count + ' words' } }
Add a <p> listing word count below the <textarea> in a <section>.
Add a <p > listing word count below the <textarea > in a <section > .