title: How do I get these DOM element names right in my javascript?
body: <p>I need create a page that has many repetitive forms that will update some divs on the page. Imagine a long list of books labeled "Book 1", "Book 2", etc. where you have to click a link to see the name of any given book. There will be hundreds. I want to use a single script to do it. I think I have it all figured out but I am not clear how to call two of the DOM elements. Note I am using jQuery (for reasons that don't have anything to do with this question, just trust that I have to use it). Here is my code with comments where I need help:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script language="javascript" type="text/javascript"
        src="/wp-includes/js/jquery/jquery.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;p&gt;Book 1&lt;/p&gt;
      &lt;form id="form001"&gt;
        &lt;input type="hidden" name="book" value="Stranger In A Strange Land" /&gt;
        &lt;input type="submit" name="submit" value="submit" /&gt;
      &lt;/form&gt;
      &lt;div id="output001"&gt;&lt;/div&gt;
  
      &lt;p&gt;Book 2&lt;/p&gt;
      &lt;form id="form002"&gt;
        &lt;input type="hidden" name="book" value="I, Robot" /&gt;
        &lt;input type="submit" name="submit" value="submit" /&gt;
      &lt;/form&gt;
      &lt;div id="output002"&gt;&lt;/div&gt;
  
      &lt;script id="source" language="javascript" type="text/javascript"&gt;
        var $j = jQuery.noConflict();
        $j( "form" ).submit(function ( )
        {
  
  
          var book = ???;        //  &lt;========= What do I put here???
          var formName = ???;    //  &lt;========= What do I put here???
  
  
          // Below I extract the form number (e.g. “001” from “form001”) and
          // tack it on to the div name I am repopulating
          var outputDiv = '#output' + substr( formName, formName.length - 3, 3 ); 
  
          $j(outputDiv).html(book);
        }); 
      &lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>