javascript how to increase height by em units

How can I increase the height of an html element, by a certain number of em units, using JavaScript?

Here’s an example that doesn’t work, but demonstrates what I’m trying to do. In the body of an html page:

<textarea id="myTextArea" style="height:10em" onclick="test()"></textarea>

Then, in the script:

function test() {
    // get the height, assign to var x
    var x = document.getElementById("myTextArea").style.height;

    // calculate height increase by 10 em
    x += "10em";

    // increase the height by amount calculated
    document.getElementById("myTextArea").style.height = x;

I want to increase by em units, not pixels.

90 thoughts on “javascript how to increase height by em units”

  1. With havin so much content do you ever run into any problems of plagorism or copyright violation? My website has a
    lot of completely unique content I’ve either written myself or outsourced
    but it looks like a lot of it is popping it up all
    over the internet without my permission. Do you know any solutions to help protect against content from being ripped off?
    I’d truly appreciate it.

  2. Pingback: nelpa plaquenil
  3. Pingback: ivermectina 3
  4. Pingback: ivomec ivermectin
  5. Pingback: new ed drugs

Leave a Comment