Reputation: 4633
I have a HyperLink given below,
<a href="www.abc.com/" id="click1" target="_blank" >Apply now</a>
I want to click the Link programatically on page load. can I do it?
Upvotes: 0
Views: 105
Reputation: 697
protected void Page_Load(object sender, EventArgs e)
{
click1.ServerClick += new EventHandler(ClearClick);
}
public void btnClear_Click(object sender, EventArgs e)
{
}
This will give u the anchor tag click on page load.
<a runat="server" id="click1">Apply now</a>
Upvotes: 0
Reputation: 28763
Try with trigger
on page load like
$(function(){
$('#click1').trigger('click');
});
Or even you can use simulate plugin and you can use like
$('#click1').simulate('click');
It triggers a native browser event.May be it also useful for you.
Or even simply you can try with
window.location.href = 'www.abc.com/';
Upvotes: 4
Reputation: 15709
Try this
$(document).ready(function(){
$("#click1").click(function(){
//your code
});
});
Upvotes: 0