Skip to content
Advertisement

Tag: html

Stop form refreshing page on submit

How would I go about preventing the page from refreshing when pressing the send button without any data in the fields? The validation is setup working fine, all fields go red but then the page is immediately refreshed. My knowledge of JS is relatively basic. In particular I think the processForm() function at the bottom is ‘bad’. HTML JS Answer

How to pass an array from HTML to Javascript?

I have a form which has multiple <select> drop-down boxes. I wish to pass the value in these drop-down boxes as an array to a JavaScript function. Currently my code is like: Where all_films is a variable from Django framework (Most probably you need not concern yourself with it). What I want to do is that even if I have

Firefox div > svg mouseover fires OUTSIDE div

I have a div with two svg-elements inside, which are shown/hidden when hovering with the mouse. The mouseover event is registered with the div. On Chrome and Safari it works, on FF the SVG sits at a different position and the “hitbox” of the div where I can hover, is very large, like 3 times the actual size of the

How to get a number of random elements from an array?

I am working on ‘how to access elements randomly from an array in javascript’. I found many links regarding this. Like: Get random item from JavaScript array But in this, we can choose only one item from the array. If we want more than one elements then how can we achieve this? How can we get more than one element

HTML5 event for `onselectionchange`

Is there a standard cross-browser HTML5 event which corresponds to IE legacy onselectionchange (so it is fired when the current selection changes)? EDITED, I’m looking to track Selection object changes. Answer use onchange I recommend using jQuery to avoid these cross browser issues, but that does not mean you should skip testing. see here. Look at Rangy window.getSelection = rangy.getSelection

Advertisement