title: jquery: delete element by specifying data attribute
body: <p>Ok. so i have got stuck in a simple situation. I want to delete <code>&lt;li&gt;</code> elements present inside some <code>&lt;ul&gt;</code>, but from its <code>data-*</code> attribute.</p>
  
  <p>I tried the code but dont know why its not working. Check out my <a href="http://jsbin.com/refevoyo/1/edit" rel="nofollow">jsbin</a>.</p>
  
  <p>Please specify where i was going wrong (because i need to learn from it).</p>
  
  <p>I know its much easy for you all... but i am not able to make out... so needed your help. Thanks..</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://code.jquery.com/jquery-1.11.0.min.js"&gt;&lt;/script&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Example&lt;/title&gt;
    &lt;script&gt;
    function deleteElement(id)
    {
      $("ul li").data("id", id).remove();
    }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;ul&gt;
    &lt;li data-id="3"&gt;3&lt;input type="button" onclick="deleteElement(3)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="31"&gt;31&lt;input type="button" onclick="deleteElement(31)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="32"&gt;32&lt;input type="button" onclick="deleteElement(32)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="33"&gt;33&lt;input type="button" onclick="deleteElement(33)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="41"&gt;41&lt;input type="button" onclick="deleteElement(41)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="42"&gt;42&lt;input type="button" onclick="deleteElement(42)" value="delete"&gt;&lt;/li&gt;
    &lt;li data-id="43"&gt;43&lt;input type="button" onclick="deleteElement(43)" value="delete"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>