title: how to read character behind some text
body: <p>this one a code for read two character behind text "KD-R411ED"</p>
  
  <pre><code>var code = data[0].substr(data[0].length - 2);
  </code></pre>
  
  <p>how to read ED character if text like KD-R411H2EDT? i want a new code can combine with code above..please help!!</p>
  
  <p>look this:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  $("#tags1").change(function() {
                                                      var barcode;
                                                      barCode=$("#tags1").val();
                                                         var data=barCode.split(" ");
                                                         $("#tags1").val(data[0]);
                                                         $("#tags2").val(data[1]);
  
                                                      var code = data[0].substr(data[0].length - 2); // suggested by Jan Willem B
  
                                                        if (code == 'UD') {
                                                                              $('#check1').attr('checked','checked');
                                                      } else {
                                                              if (code == 'ED') {
                                                                              $('#check2').attr('checked','checked');
                                                      }
                                                       }
  &lt;/script&gt;
  </code></pre>
  
  <p>and this one</p>
  
  <pre><code>&lt;input id="check1" type="radio" class="check" name="check" onclick="addtext()" value="U" /&gt;U
  
  &lt;input id="check2" type="radio" class="check" name="check" onclick="addtext_1()" value="E" /&gt;E
  </code></pre>