get current page url with jquery

how to get current page url with help of jquery.

by dhaval dave

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<p>Current page URL: <span id="current_url"></span></p>

JavaScript

$(document).ready(function() {
    $('#current_url').html($(location).attr('href'));
});