0

I use href to send action to the controllr but I ask if it's possible to use button instead href to do the action. this is my code

<a href="{{ path('adduser') }}" class="btn btn-lg btn-default highlight_black stylish ">create user</a>

so instead <a href ...> I want to use

<input type="button">

Thanks for help

2 Answers 2

4

I added a script

document.getElementById("mybutton").onclick = function () {
    location.href = "{{ path('adduser') }}";
};

and now it work perfectly

Thanks for your helps

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. You should accept your answer or another if it helps you.
3

I don't see the point of make your links using an input, but yes, you can.

Do something like this :

<input type="button" onclick="location.href = {{ path('adduser') }};" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.