Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Q2A Theme: location.href javascript function is not working

+2 votes
asked Jun 23 in Themes by Bùi Lê Chí Bảo
edited Jun 24 by Bùi Lê Chí Bảo

I am trying to implement features for SSO site to make it not so different from the old one. 

'buttons' => array(
     'account' => array(
              'tags' => 'onClick="qa_edit_profile()"',
              'label' => qa_html("Edit Profile") ,
      ) ,
) ,

As you can see, the onClick event will call the qa_edit_profile() function which I has written in qa-content\qa-page.js file:

function qa_edit_profile()
     location.href = "www.yoursite.com";

But when I click, it doesn't work. While other function works like alert(),...

So the question is, is there any solution to make the browser redirect to an URL when click on a button?

1 Answer

+1 vote
answered Jun 24 by pupi1985

"But when I click, it doesn't work." -> What happens exactly? Are you getting a "qa_edit_profile() function not found"? Are you getting redirected to the wrong URL?

Check if this works:


If it does, add it to the function and check if it works.

If it does, most likely you were just missing the protocol in the redirect string.