The Body: Markup Layer

Now that we have our script includes and styles, let’s take a quick look at the markup that we will be generating for this example:

<body>
<form action="javascript:void(0);">
    <div id="errorMsg"></div>
    <input type="text" name="file" id="file" />
    <input type="submit" value="Load File" onclick="getFile()">
</form>

<div class="contentBox contentRendered">
    <div class="header">Original Content: Rendered</div>
    <div id="original_rendered"></div>
</div>
<div class="contentBox contentRendered">
    <div class="header">Cajoled Content: Rendered</div>
    <div id="cajoled_rendered"></div>
</div>

<div class="clear"></div>

<div class="contentBox contentRaw">
    <div class="header">Original Content: Raw</div>
    <div id="original_raw"></div>
</div>
<div class="contentBox contentRaw">
    <div class="header">Cajoled Content: Raw</div>
    <div id="cajoled_raw"></div>
</div>

This content consists of two parts:

  • The form that includes an input box to enter the file location from which we will load our example content. When the user clicks the submit button, the getFile() function will be called to collect the file content. This form also includes an error messaging node that we’ll use to display a basic message to the user if there is a problem loading the file.

  • The div nodes that make up the four quadrants of our example:

    • The rendered original content (top left).

    • The raw original content (bottom left).

    • The rendered cajoled content (top right).

    • The raw cajoled content (bottom right).

Now that we have the ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.