<script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
//waits till the document is ready
$(document).ready(function() {
//onclick function
$('button.butter').click(function(){
//code will only run on certain url
if (pathname.indexOf("google")>= 0){
alert('This doesn't work anymore!');
//replacer
$("a[href*='https://google.com']").attr('href',('http://www.google.com/search?q' + $('#FormID').val()));
}
else{
alert('Wrong page');
}
});
});
</script>
It doesn’t alert, but why? This was working earlier and I forgot to save it. It should replace the url with another one plus the value from a field. edit: head, html, etc. tags are there.
<button class="butter">Press</button>
I think you want
location.pathnamerather thanpathname