convert javascript to jquery code example

Example: code convert java script to jQuery

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
    var element = $("#tgtP");
    var a = element.text();
    var b="";
    element.click(function(){
       for (i = 0; i < a.length; i++)
       {
          if (a.charCodeAt(i) >= 65 && a.charCodeAt(i) <= 90)
           {
                 b = b + a.charAt(i).toLowerCase();
           }
          else
           {
                 b = b + a.charAt(i).toUpperCase();
           }
           alert(b);
        }
    });
});
</script>
</head>
<body>
<p id="tgtP">aBc dEf ghIK kl</p>
</body>
</html>