title: jquery replace text in nested list
body: <pre><code>&lt;ul class="playlist"&gt;
      &lt;li class="track_name"&gt;$name1
          &lt;ul&gt;
              &lt;li class="play"&gt;&lt;a class="play_link" href="$url"&gt;play&lt;/a&gt;&lt;/li&gt;
              &lt;li class="download"&gt;&lt;a href="download.php?id=$url"&gt;download&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt; ... more tracks here
  &lt;/ul&gt;
  &lt;ul class="playlist"&gt;
  ... more playlists here
  </code></pre>
  
  <p>Given a dynamically generated unordered nested lists, what is the easiest way to replace text 'play' in <code>&lt;li class="play"&gt;</code> with $name1?</p>
  
  <p>I've done the following:</p>
  
  <pre><code>var val = $('.play').closest('.track_name').clone().children().remove().end().text();
  $('.play_link').text(val);
  </code></pre>
  
  <p>This gives me all track_names, but can't figure out how to get just the relevant track name.</p>
  
  <p>TIA!</p>