如何点击超链接(<a> tag) automatically by clicking only a submit button in html?

时间:2016-02-04 08:15:50

标签: php html5 laravel-5

<input type='submit' name='btnAdd'  onclick="{{ route('eventCal_index', $_SESSION['title']) }}" value='Add event' >

Submit button should be both work for submission and navigate to that route

That means without clicking the hyperlink, by clicking the submit button I want to click another link automatically. Simply, Is there a way to click a hyperlink(<a> tag) automatically

2 个答案:

答案 0 :(得分:0)

在路线功能结束时添加

<style>
.main-inner {
  width:100%;
  border:2px solid #f00;
}
</style>

请参阅此页面了解更多详情: - http://www.w3schools.com/JQuery/event_trigger.asp

答案 1 :(得分:0)

试试这个 //在提交表单时,您可以触发点击事件。

$('form').on('submit',function()      
{
    $('a').trigger('click');
});