Change div content on ImageClick [duplicate] - javascript

This question already has answers here:
Change DIV contents using jQuery when link clicked
(6 answers)
Closed 8 years ago.
So, i'm working on this: http://silviucazacu.com/cold and i want to change the content(image&player) when i click on the images in the left.
I want to have all on the same page, but hidden and on image click to appear on center.

Could you be more precise ?
It's kind of easy to do it, you should have researched it.
Edit your img tag like
<img onclick="someJScodethatwillbeexecutedonclicked"></img>

Related

Javascript select from html by using alt tag [duplicate]

This question already has answers here:
Find an element in DOM based on an attribute value
(11 answers)
Closed 2 years ago.
i need a to make javascript select and click an image from an alt tag
this is the code that i need to select and click with javascript
<img alt="cat" src="img1.jpg">
this is what i tried to do
document.querySelector('cat').click
The selector should be img[alt="cat"]:
document.querySelector('img[alt="cat"]')

How do i append a div using javascript and not jquery? [duplicate]

This question already has answers here:
Create <div> and append <div> dynamically
(9 answers)
Closed 2 years ago.
I used a query selector to get the div i want to append. But the created div doesn't want to append to anything other than the body. Is there a way i can make it specifically append under the div?
Look at this: https://www.w3schools.com/jsref/met_node_appendchild.asp
What you need to do is
parent.appendChild(thatDiv);

Remove element by the text inside [duplicate]

This question already has answers here:
How can I find elements by text content with jQuery?
(8 answers)
Closed 4 years ago.
how can I remove an element using jquery by the text in the element.
Link1
I dont want to remove the element by class or ID. I want to do something like this:
$('a').html('Link1').remove()
Can you help me with this?
Please try this
jQuery
$('a:contains("Link1")').remove();
Demo fiddle
For more reference please refer this.

Get css values of a hover element in an iframe [duplicate]

This question already has answers here:
Access the css ":after" selector with jQuery [duplicate]
(3 answers)
Closed 8 years ago.
I can get css of an element in an iframe by this way:
var bg_color = $('iframe.#myIframe').contents().find('div#someId').css('background-color');
but I can't get:
var bg_color = $('iframe.#myIframe').contents().find('div#someId:hover').css('background-color');
So, how can I get css of a hover element in an iframe (same domain)? Please help me! Thanks!
This cannot be done, the iFrame is literally a window to another webpage, therefor it is not in your DOM, and not accessible by your jquery

How to replace a link regarding to a class in javascript? [duplicate]

This question already has answers here:
How can I add "href" attribute to a link dynamically using JavaScript?
(9 answers)
Closed 8 years ago.
In my site I have one div like this
<div class="yjme_item_in yjmeitem29">
inside this div there is a link and I would like to replace the href of it, introducing www.google.com.
Any ideas ?
I have tried this with no luck
var a = document.getElementsByClassName("yjmeitem29")[0];
a.setAttribute("href", "www.google.es");
Try this
a.childNodes[0].setAttribute("href", "www.google.es");

Categories