Skip to content
Advertisement

Tag: html

How to get a number value from an input field?

I have some issues with calculating some stuff with JS and getting the right values out of the input fields (number). When I use this code it doesn’t show anything. So what is wrong with my JS? Do I need to include a jQuery file? Answer You had some mistakes in your HTML, but here is a working JSFiddle: Fiddle

Check if there’s some text inside an element

I am creating an If…Else statement and need to check if the element has innerHTML / textContent. Like this: So, how do I do that using Javascript? Please, help! UPD! I have dynamically changing content, and seems not working after I put some text inside my < span >. I mean it still thinks the < span > is empty.

HTML5 Video: Displaying two different subtitles simultaneously

I am using the standard HTML5 video subtitle functions to display subtitles (provided in srt and vtt) in the builtin HTML5 video player. Now I need to have two different subtitles to be display simultaneously, so the second subtitle is displayed on top of the first subtitle. (Unexpectedly) I can’t find any helpful information on the web for displaying more

Set URL to load iframe in a Django template

I want to load an iframe into a Django template. The template is getting loaded correctly, but in place of the iframe, the template itself is getting embedded inside the parent template. The code relevant is given below: testgame.html is a file located in the same directory as this HTML template, but it doesn’t load. In its place, the parent

Communication between tabs or windows

I was searching for a way how to communicate between multiple tabs or windows in a browser (on the same domain, not CORS) without leaving traces. There were several solutions: using the window object postMessage cookies localStorage The first is probably the worst solution – you need to open a window from your current window and then you can communicate

JS Set background image of span

JS: HTML: I was wondering if it would be possible to also set the source of an image in this HTML from my Javascript code. So if I get “Item One” it will display that image in my HTML? Answer You just need to create an array containing the paths to your images such as var images = [“image1.png”, “image2.png”]

HTML5 Canvas Javascript how to make smooth brush

Hello i need make smooth brush likes this: I try to create it, i make circle and fill it, but result not successful: Can be seen circles.. this is not smooth like first example my example code: http://codepen.io/anon/pen/NPjwry Answer Try with a smaller globalAlpha and decrease the stepping (so you draw more circles) Updated codepen: http://codepen.io/gpetrioli/pen/ramqBz

Converting base64 to blob in javascript

I tried to convert a JPEG’s base64 string to a blob on a Cordova/hybrid app running on iOS 8 using the following function b64toBlob. However it’s giving an error when we do How can be work around this error? Answer Try this out. Please note that dataURI is assumed to include base64 prefix. (e.g. “data:image/jpeg;base64,”) Usage:

Advertisement