title: jQuery: how to count elements with similiar but dynamic ID
body: <p>I want to count elements with a certain ID with jquery.
  My Application has blocks which have multiple lines which have multiple fields.</p>
  <p>my fields have id's like that: &quot;field_B1_L1_1&quot; that would be the first field in the first line.
  It's easy to count all fields there are in all blocks:</p>
  <pre><code>$(&quot;:input[id^=field]&quot;).length
  </code></pre>
  <p>But what am i doing if i want to count all fields in line y from block x?</p>
  <pre><code>$(&quot;:input[id^=field_B{x}_L{y}]&quot;).length how can i put the variables in here?
  </code></pre>