title: Remove part of a string from a variable jquery
body: <p>I'm trying to take the id of a mouseover and strip out part of the ID, to leave me with just the core text I need to act on.</p>
  
  <p>My mouseover will return an id such as "nevadaActiveArea", but I need to manipulate that string down to just "nevada". All the searches I've run speak to how to do this on the contents of some element, but I just need the text in a variable. How do I achieve this?</p>
  
  <p>Final code based on Josh Stodola's answer:</p>
  
  <pre><code>$("area").mouseover(function(){
      var overID = $(this).attr("id");
      if(overID.indexOf("ActiveArea") &gt;= 1){
          id = overID.substring(0, overID.indexOf("ActiveArea"));
      }else if(overID.indexOf("Hotspot") &gt;= 1){
          id = overID.substring(0, overID.indexOf("Hotspot"));
      }
  
      $("#"+id).show();
  });
  </code></pre>