DigitalHistory / 03-js-dom

Javascript, DOM, and Data Assignment for Digital History
0 stars 4 forks source link

Add DOM manipulation functions to part 1 #7

Open titaniumbones opened 4 years ago

titaniumbones commented 4 years ago

Rightn ow all functions only manipulate html strings and set html content. Would be useful for sutdents to learn to manipulate DOM directly; this is somewhat confused & confusing at present.

here's some code to start with


/*  Problem 1d: Write a simple function that generates an HTML elemnt
 *  object when passed two variables: tag CONTENT and and tag NAME. So
 *  for instance, `tagItElement ("look at me!", "div")` should return a JavaScript dom object...
*/

/**
 * return a string of the form <tagName>content</tagName>, where `content`
 * and `tagName` are string parameters passed to the function.
 * @param {string} content
 * @param {string} tagName
 * @returns {string} 
 */
function tagItElement(content, tagName) {
  return $
  return '';
}
titaniumbones commented 3 years ago

This turns out to be difficult to do. See final note in README. Students would need more prep before doing this.