Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to finish my application but to do so I want to create a popup that will be triggered when a link containing the class of "extlink-modal-trigger" this will trigger a popup/dialog that shows a quick warning like Facebook and when its clicked it will pull the href with it and insert it into a button
Hopefully you understood that but if you dont then please give me a comment sorry if this lacked any detail
I'm trying to create something similar to this http://jsfiddle.net/GsCBr/
$('a[href^=http]').click(function(){
alert('You are leaving this website.','Warning');
});
But It will only be trigger if it has the appropriate class and it should show as a popup
You can do this in following way:
$(document).ready(function () {
$('a.extlink-modal-trigger[href^=http]').click(function (e) {
e.preventDefault();
alert('You are leaving this website., Warning');
$("#link").html(this.href); //do whatever you want with link
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Click here to leave site.
Click here to leave site.
<button id="link"></button>
Working fiddle with bootstrap modal
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to add an if statement to the code on the bottom, I was able to add console.log and it worked but need to have it where it goes something like "if(something).onClick open this page" please help.
$.myFunc = function(){
console.log("clicked");
}
I think you are asking about on click event? For example user click on button you want to perform an action?
You need to give id or class to that element and using jQuery you can listen to the onClick event when it gets triggered.
$("#button").click(function(){
//your code here
});
No need to put if condition in function.
P.s - Use # for id and . for class.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
A js generated code snippet from a third party places a fixed button on the top of the page and when the button is clicked it shows a modal of a form. I'd like to create a custom button to replace the look of the provided from the snippet but still call the form on the click event. Is that possible?
<script type="text/javascript" src="https://pluginInfoandIds"></script>
If the button has an id (I assume it has) you should be able to just override the stylesheet information with your own. Through js you should also be able to add/remove classes (provided your script runs after theirs).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to trigger an event inside the website using an email external link(gmail, outlook). I have a sign up form that slides that in and out from the website using a button. Would it be possible if I click an email external link that sign up form would slide in once the page renders
Yes, you can. Just apply some specific flag in URL. E.g. http://example.com/form.php#some-flag
Than in JS:
$(document).ready(function () {
if (window.location.hash == '#some-flag') {
triggerEvent();
}
});
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a jQuery application that adds a "tile" when i click "addTile" button. The resultant tile will have a menu of buttons (google, youtube, ...), which on click, removes the button menu and replaces it with the respective widget. This part is working fine. The next part includes adding the widget directly on load. Whcih means i have to programmatically click() the "menu" button which is not yet on the DOM. If i want to display a google widget directly on load of the document, how can i do that?
i am right now at this.
$(document).ready(function () {
$("#addTile").click().$("#setGoogle").click();
});
Do not try and click the button. That's impossible. Instead... only try to realize the truth...
There is no button.
You'll see, that it is not the button that clicks, it is the functionality of that said button that needs to be invoked directly.
try below thing
$(document).ready(function () {
$("#addTile").trigger('click');
$(document).on('click','#element_id',function(){
alert('click event is triggered');
});
$("#element_id").trigger('click');
});
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am building a website (Static HTML Website). In my index page, I have an image slider. I used JQuery for that. On clicking any image, that will pop up. And there is a link, for which I used another JQuery function. On clicking that link, a window will pop up. But the problem is that I am not able to use both of them at the same time. I defined both the functions inside
$(document).ready(function () { });
Is it because of that??
$(document).ready(function () { });
Is just making sure nothing inside get's fired before the whole page is loaded.
I think you could get much more specific help if you would post the whole code.