title: how to assign variable as div name in jquery
body: <p>when click link i calling <code>ajax</code> method which will return data as <code>object</code>. In data which will have my group name. I am trying to <code>empty the group and create a new div</code> but i am getting error Please let me know some thing from your end :).    </p>
  
  <pre><code>function loadData(data) {
      var view = new entryView(data);
      var groupName = data.name;
      $("#groupName").attr('id').empty();
      // error - typeerror $(...).attr(...) is undefined jquery
      alert($('#groupName').attr('id'));
  }
  
  entryView(data) {
      this.name = this.data.name
  }
  </code></pre>
  
  <p>I keep getting <code>TypeError: $(...).attr(...) is undefined</code>. Can someone please tell me what the problem is? My jQuery is below. Thank you.</p>