Reputation: 3704
How can i remove parameter from the link which i made through the following script... this include the use of jquery and if possible please let me know the solution in the jquery script
<script>
$(function() {
$('a[name="searchLink"]').bind('click', function() {
var a =$(this).attr('href', $(this).attr('href') + '?startdate=' + start().StartDate +'&enddate=' + start().EndDate);
})
})
</script>
Upvotes: 0
Views: 120
Reputation: 534
Here is solution of your question.
You have this function which creates url
$(function() {
$('a[name="searchLink"]').bind('click', function() {
var a =$(this).attr('href', $(this).attr('href') + '?startdate=' + start().StartDate +'&enddate=' + start().EndDate);
})
})
So to get only base url for this you can just use this simple code where i have use sample url. your may be vary
$( document ).ready(function() {
var baseurl = $('.link').attr('href').split('?')[0];
console.log(baseurl);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class="link" href="https://support.google.com/mail/answer/56256?hl=en&test=213213321312">Normal Sample URL</a>
Upvotes: 2