javascript Image tag

0 votes

I'm adding an image snapshot of a webcam to a div using jquery (2.1.3)

Why does this not work:

var image = new Image();
image.src = "data:image/jpg;base64," + data;
image.width = "320px";
image.height = "240px";
$("#video").html(image);

The image tag has sizes 0 for w and h;

This does work

var image = $("<img>", {
    "src": "data:image/jpg;base64," + data,
    "width": "640px", "height": "480px"});
$("#video").html(image);
Nov 8, 2022 in Java by Nicholas
• 7,760 points
278 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
2 answers

How can we add an image to a JPanel?

If you are using JPanels, then are ...READ MORE

answered Sep 20, 2018 in Java by Daisy
• 8,120 points
10,982 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

answered Jun 29, 2018 in Java by Daisy
• 8,120 points
581 views
0 votes
1 answer

What is the equivalent to a JavaScript setInterval/setTimeout in Android/Java?

Hii @kartik, As always with Android there's lots ...READ MORE

answered May 26, 2020 in Java by Niroj
• 82,880 points
3,198 views
0 votes
1 answer

What does "javascript:void(0)" mean?

The href of the link helps with ...READ MORE

answered Feb 8, 2022 in Java by Rahul
• 9,670 points
688 views
0 votes
1 answer

Render HTML to an image

To answer your question, there are a ...READ MORE

answered Feb 8, 2022 in Java by Soham
• 9,700 points
1,563 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,510 points
1,004 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,880 points
14,321 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,880 points
22,476 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,880 points
2,990 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP