How can I append html to an ID'd element (why isn't .append() working)?
I want to append some html to an element; so far my failure is so catastrophic as to make Napoleon's battle at Waterloo seem like a roaring success by comparison. Before adding it to actual code, I tried fiddling around first with
these variations on the theme, based on what I got from
here, but it's not working. What am I missing/doing wrong?
The HTML from the fiddle is:
- <h2>REPORTS TO BE GENERATED</h2>
- <table style=\ "width:100%\">
- <tr>
- <th>Report Name</th>
- <th>Unit</th>
- <th>Generation Date</th>
- <th>Data Begin Date</th>
- <th>Data End Date</th>
- <th>Recipients</th>
- </tr>
- <tr>
- <td>Produce Usage</td>
- <td>ABUELOS</td>
- <td>5/11/2016</td>
- <td>5/11/2016</td>
- <td>sOMETHING</td>
- <td>Something Else</td>
- </tr>
- </table>
- <div id="fillme">
- <label id="lbl">hey</label>
- </div>
- <iframe id="orme">
- </iframe>
The Javascript from the fiddle is:
- $( "#fillme" ).append( $( "<h2>REPORTS TO BE GENERATED</h2>" ) );
- $( "#orme" ).append( $( "<h2>REPORTz TO BE GENERATED</h2>" ) );
- $( "#orme" ).append( "<h2>REPORTz TO BE GENERATED</h2>" );
- $( "th" ).append( $( "<h2>REPORTz TO BE GENERATED</h2>" ) );
- $( "#lbl" ).append( $( "<h2>REPORTz TO BE GENERATED</h2>" ) );