Click to display content (or change property) in HTML. How to code?
-
How to code something like this in html? if (btn.click) { imageUrl = http... Logic - When clicking (.click) in an image (btn) changes property (url) in another image in the same page. Thanks in advance! João
-
Answer:
If you are using jquery, it should be fiarly simple: Something like this: $('#btn').click(function(){ $('#myImage').attr('src','my_new_source.jpg'); }); You can also get this using regular javascript: <button id="btn" onclick="document.getElementById('myImage').src='newimage.jpeg'"> Click me </button>
Prashant Chaudhary at Quora Visit the source
Related Q & A:
- How to Code Encryption Algorithm in Java?Best solution by code2learn.com
- How do I display limited html content in a webview?Best solution by Stack Overflow
- Which frogs can change their gender and how?Best solution by sites.google.com
- I want to change my look but how.Best solution by Yahoo! Answers
- I want to display my picture on my messenger window, how can I do it.Best solution by mydisplayimage.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.