title: How to fire click event in jQuery?
body: <p>I am a beginner in jQuery programming. I am trying to fire a click event on list click, but it is not working properly. The following is my code: </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" &gt;
  &lt;script type="text/javascript" src="jquery.js"&gt;
  
  &lt;link rel="stylesheet"  href="style.css" /&gt;
  $("ul#select li").click(function(e){
      //targ = $(e.target);
      if($(this).hasClass("selected"))
      {
          $(this).removeClass("selected");
          document.location= "cambridge:clearanswer";
      }
      else
      {
          currentanswer = $(this).html();
          document.location = "cambridge:checkanswer:"+currentanswer;
          $("ul.select li").removeClass("selected");
          $(this).addClass("selected");
      }
  });
  
  function getUsed()
  {
      var total = "";
      $(".boxWord.boxWordUsed").each(function (i){ total = total + this.getAttribute('index_no') + ":"; });
      return total;
  }
  
  &lt;/script&gt;
  &lt;/script&gt;
  &lt;link href="style.css" media="all" rel="stylesheet" type="text/css" /&gt; 
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="question" &gt;
  &lt;ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b" class="select" id="select"&gt; 
              &lt;li data-role="list-divider" class="selected"&gt;Overview&lt;/li&gt; 
  &lt;li data-role="list-divider" class="selected"&gt;Overview&lt;/li&gt; 
  &lt;/ul&gt;
  &lt;/div&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>