"Responsive Jquery" If width add div link else remove div link

"Responsive Jquery" If width add div link else remove div link

I have this code that turns a div into a link when the screen is sized to a specific width. How do I get it to remove the link when the width is larger?

  1. $(window).resize(function(){
  2.     if ($(window).width() <= 768) {
  3.         $(".discussionListItem .main, .nodeList .nodeInfo, .memberList .memberListItem").click(function(){
  4.              window.location=$(this).find("a").attr("href"); 
  5.              return false;
  6.         });
  7.     } else if ($(window).width() >= 769) {
  8.         $(".discussionListItem .main a, .nodeList .nodeInfo a, .memberList .memberListItem a").removeAttr('href');
  9.     }
  10. });