Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery change document.location.href in input

Tags:

jquery

is it possible to use jQuery to do that:

if the body has a <div id="wpadminbar"> then change the document.location.href in this input from

<input type="button" onclick="document.location.href='/wp-login.php?action=register';" value="Forum" id="forum">

to

<input type="button" onclick="document.location.href='/forum';" value="Forum" id="forum">
like image 757
user832375 Avatar asked Jan 29 '26 05:01

user832375


1 Answers

if($('#wpadminbar').length > 0) {
    $('#forum').attr('onClick', "document.location.href='/forum';");
}
like image 157
Naftali Avatar answered Jan 31 '26 20:01

Naftali