title: javascript get element by ID within ID
body: <p>I would like to calculate the total price of the  if check box is checked by using JavaScript <br/>
  I'm not allow to separate the id to 2 section of by adding div<br/>
  for example.</p>
  
  <pre><code>&lt;form id="bookingForm"&gt;
  
   &lt;section id = "checkcost"&gt;
        &lt;h2&gt;Total cost&lt;/h2&gt;
       Total &lt;input type="text" name="total" value="$0.00" size="10" readonly /&gt;
   &lt;/section&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>First, i use this method get the id </p>
  
  <blockquote>
    <p>var frm = document.getElementById('bookingForm')
    <br/></p>
  </blockquote>
  
  <p>i m  trying to do by using the following code but this is not the correct method</p>
  
  <blockquote>
    <p>frm.checkcost.total = calculate()</p>
  </blockquote>
  
  <p>Since the input area to shows the total cost is inside the id="bookingForm", how should i display the total cost once the check box is checked?? <br/>
  ps:  here is the link i had try but it didn't work, and now i'm trying other method </p>
  
  <p><a href="https://stackoverflow.com/questions/43179973/onclick-in-php-echo-with-error-invalid-unexpected-token">onclick in php echo with error invalid unexpected token</a></p>