admin管理员组文章数量:1325236
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
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
Share Improve this question edited Feb 16, 2016 at 19:59 chalasr 13.2k5 gold badges43 silver badges83 bronze badges asked Feb 16, 2016 at 9:31 Majdi TalebMajdi Taleb 7613 gold badges9 silver badges26 bronze badges2 Answers
Reset to default 4I added a script
document.getElementById("mybutton").onclick = function () {
location.href = "{{ path('adduser') }}";
};
and now it work perfectly
Thanks for your helps
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') }};" />
本文标签: javascriptUsing button instead href to call action in symfony2Stack Overflow
版权声明:本文标题:javascript - Using button instead href to call action in symfony2 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742168099a2426204.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论