title: how to add 'selected' attribute in <li> using jQuery or Javascript
body: <p>I wanted to add 'selected' attribute by comparing the value between <code>&lt;li&gt;&lt;/li&gt;</code></p>
  <pre><code>&lt;ul class=&quot;list&quot;&gt;
  &lt;li data-value=&quot;0&quot; class=&quot;option&quot; selected&gt;All Categories&lt;/li&gt;
  &lt;li data-value=&quot;75&quot; class=&quot;option&quot;&gt;eBriefs&lt;/li&gt;
  &lt;li data-value=&quot;74&quot; class=&quot;option&quot;&gt;Hawkeye-articles&lt;/li&gt;
  &lt;li data-value=&quot;1&quot; class=&quot;option&quot;&gt;Hhhhh&lt;/li&gt;
  &lt;li data-value=&quot;93&quot; class=&quot;option focus&quot;&gt;Hyphen-Newsletter&lt;/li&gt;
  &lt;li data-value=&quot;95&quot; class=&quot;option&quot;&gt;Infographics&lt;/li&gt;
  &lt;li data-value=&quot;76&quot; class=&quot;option&quot;&gt;News&lt;/li&gt;
  &lt;li data-value=&quot;134&quot; class=&quot;option&quot;&gt;Podcast-webinar&lt;/li&gt;
  &lt;li data-value=&quot;79&quot; class=&quot;option&quot;&gt;Podcasts&lt;/li&gt;
  &lt;li data-value=&quot;81&quot; class=&quot;option&quot;&gt;Success Stories&lt;/li&gt;
  &lt;li data-value=&quot;94&quot; class=&quot;option&quot;&gt;Videos&lt;/li&gt;
  &lt;li data-value=&quot;77&quot; class=&quot;option&quot;&gt;Webinars&lt;/li&gt;
  &lt;li data-value=&quot;83&quot; class=&quot;option&quot;&gt;Whitepapers&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  <p>For example, I wanted to add 'selected' attribute to Podcasts, and removing <code>selected</code> from <code>All Categories</code> option.</p>
  <p>Like, I wanted to check if the text between <code>&lt;li&gt;&lt;/li&gt;</code> is <code>Podcasts</code> then put selected attribute in <code>&lt;li data-value=&quot;79&quot; class=&quot;option&quot;&gt;Podcasts&lt;/li&gt;</code></p>
  <p>and make it</p>
  <p><code>&lt;li data-value=&quot;79&quot; class=&quot;option&quot; selected&gt;Podcasts&lt;/li&gt;</code></p>
  <p>Major goal is to put selected attribute by comparing value <code>&lt;li&gt;&lt;/li&gt;</code></p>
  <p>How can I do it with jQuery or javascript?</p>