I loaded a page with an iframe inside a webpage of my site.
Now, I need to auto click the button into the iframe, after the page is loaded.
The button code is:
<button type="button" id="submit-button" class="btn trusted-commit-payment">pay now!</button>
Can anyone tell me the code to do this?
I hope this will help.
Javascript
document.getElementById("myframe").addEventListener('load', function() {
document.getElementById("submit-button").click();
});
JQuery
$('iframe').on('load',function(){
$('#submit-button').click();
});
Read this
Related
I have a simple HTML button to trigger jquery function but when i add this button to webform it triggers post-back.
Play
I tried adding OnClientClick="myfunction(); return false;" but it sill postback.
How can i use simple button without postback
Try adding stoppropagation() to your function
If you are using input tag with type="submit" or button tag with type="submit" than clicking it will cause the page to submit. So you may need to use type="button".
<input type="button" onclick="yourfunction()" value="SomeValue" />
I need help to come to the sign in page once clicking on logout button from any of the inside pages in Meteor.My code is below which does not work,
test.html
<div class="container">
Welcome <span>Deal Manager</span> | <a id="logout" href="#">Logout</a>
</div>
test.js
'click #logout': function() {
history.go("/login");
}
Hey I could try and find out the solution as below
replaced this
history.go("/login");
with
history.go(-2);
As per the pages I have replaced the path with the number.Hope this is a solution for the long run as well.
I am working on an application where I am using Ember JS .the button click is not working on MAC devices(Pc or mobile ) but the same code is working on others.. Please help me with this
{{#view App.AddNewFirm contentBinding="this"}}
<div style="cursor:"pointer">
<button style="cursor:pointer" class="btn btn-info"><i class="fa fa-user fa-fw"></i> Add Firm</button>
</div>
{{/view}}
We've had the same problem,
The click handler bound to the view did not fire on an ipad device.
We could fix it by binding click handler directly on the button, using the didInsertElement hook, instead of using the click handler ember provides
App.AddNewFirmView = Ember.View.extend({
didInsertElement:function(){
this.$('button').click(function(){
console.log('click');
});
},
});
You could also wrap your view within a <button> </button> although i discourage this.
I have a page in c# that redirects to another page like
Response.Redirect("default.aspx?name=" + user.Firstname + "&surname=" + user.Lastname).
default.aspx has a lightbox. I want to open this lightbox when I redirect the page that include this lightbox. Also, I want to show the parameters in that lightbox input fields. Is there a way to achieve this?
Thanks for any help.
I am afraid you cannot do it with Lightbox.
Lightbox plugin works on <a> tag and fetches value form href attribute. Also it specially design for Images as you can see if you provide a URL to page it doesnt load it.
For Intance,
if you provide,
<a href="page.html" id="a1" >Click Me</a>
it will keep showing the loading page.
Instead try using thickbox to show the current user parameters.
For thickbox to show a page you can use
<script language="javascript" type="text/javascript" src="javascript/thickbox.js"></script>
<a id="a1" href="#" title="Click me" class="thickbox">Call me</a>
<script type="text/javascript" >
$(document).ready(function(){
var anchor = document.getElementById("a1");
var username= '<%= Request.QueryString["username"]%>';
var url="second.html?height=500&width=700&modal=true&TB_iframe=true&username="+username;
$('#a1').attr("href", url);
anchor.click();
});
</script>
Let me know if it worked.
<iframe id="myFrame" runat="server" name="main" width="100%" src="http://www.somewebpage.com/" />
This is simple iFrame I put on my webpage. After I click on couple of buttons on that website, iframe source remains the same. But I want to be able to retrieve the changed source every time I click on buttons, links etc...
How can I achieve this?
Edit: This is the screenshot of my work. When I click on "Git" button, webpage loads on the iFrame. However, when I surf on the website, I want textbox to be updated to the source of the iFrame.
Ok, here is an idea that I test it now and its work. You change the input box after the iframe loads using the onload event of the iframe
<script>
function HasChange(me)
{
document.getElementById("WhereIamId").value =
document.getElementById("WhatIShowID").src;
return false;
}
</script>
and the html
<input type="text" id="WhereIamId" value="" />
<iframe src="page1.aspx" onload="return HasChange(this);" id="WhatIShowID" ></iframe>
You can use also the document.getElementById("<%=myFrame.ClientID>") to get the rendered id. After your iframe loads you update the text box with the current url.