JQuery- document.ready function not working [closed] - javascript

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.

Related

How to generate html page with a link [closed]

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 1 year ago.
Improve this question
How do I implement video keys on my website?
Like when I click a link, it generates an html page containing a specific type of content and gets deleted in certain amount of time.
I haven't done anything code yet.
My only solution is to hard code every html page not generating it.
I don't know how to make those like in YouTube where they can generate "watch?v=[key]" like that
thank you in advance :)
You can use window.open() open new window
const openWidow = ()=>{
var win = window.open("https://www.youtube.com/watch?v=Gjnup-PuquQ", 'window name', config = 'height=500,width=500');
}
also can use window.close() close this window
reference Window.open

adding if/else statement to jquery function [closed]

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.

Programmatically clicking a button that is not yet existing in DOM (jQuery) [closed]

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');
});

Jquery Toggle with Div Slider [closed]

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
well i was planning to do something like this:
http://www.bluefountainmedia.com/portfolio
That every time you click on the image, the div below will show, and if im going to click other images, it'll toggle back up, then open the next portfolio with the same div but different images and descriptions on the side.
Note: they have the same div, just calling out different items.
Thank you.
Actually if you look at the console, they are calling different divs. You could probably get it done quickly using jQuery .slideUp() / .slideDown().

Leaving Site Warning Javascript [closed]

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

Categories