I am using Knockout.js to populate a set of HTML5 <details> elements. Here is the structure: The data in the ViewModel looks something like this: I want to add the ability to remember the open or closed state of the details view. I have implemented this behavior previously using jQuery and localStorage1, but for this project I want to use
Tag: html
Binding .click and .blur event handlers
I’m running into a problem binding both a .blur and .click event handler to the same clickable element. The UX I’m going for is as follows: a user clicks on the search icon and the search field appears; when a user clicks again on the search icon, they can collapse and hide the search field. If they click away, the
How do I open up a random url from a list of url’s in a new time each time it is clicked?
I have some code that’ll allow me to open up a random website from a list of websites but I’d like to open each one up in a new tab, how do I do this? Information you may need the code I tried doing the action in question at two different points and hope you’re input can help to correct
How can I show the same HTML 5 Video twice on a website without loading it twice?
I currently have 2 video elements on my html-page. Both embed exactly the same .mp4 video from the same URL. Is there any way to tell the browser to duplicate the rendered video from the first video element instead of letting the browser download both videos? You can cleary see that the two videos are loaded seperated as they have
MutationObserver and Shadow DOM
I’m using Polymer’s ShadowDOM and MutationObserver polyfills and need to: Detect when a HTMLCanvasElement is inserted so that I can perform layout (its width and height are undetermined through offsetWidth / offsetHeight when detached from the DOM tree) Detect when the element is removed so I can halt its requestAnimationFrame loop Traditionally, without Shadow DOM, this works as follows: Attach
Slide down animation from display:none to display:block?
Is there a way to animate display:none to display:block using CSS so that the hidden div slides down instead of abruptly appearing, or should I go about this a different way? And a JSFiddle Answer Yes, there is a way: http://jsfiddle.net/6C42Q/12/ By using CSS3 transitions, and manipulate height, rather than display property: More here: Slide down div on click Pure
How to auto convert an url into a hyperlink when it is pasted
When I tried to paste an url in the text box like https://stackoverflow.com/ it doesn’t convert to a hyperlink automatically. i tried using regular expression this is the Question i asked before. The function that i use in this question works fine, but actually it will replace all links including links in tags (IMG, existing A HREFs). i dont want
HTML canvas image from rgb values
I have three 12×12 arrays, each with R, G and B values. How would I go about outputting the image (12×12) using HTML Canvas? I’ve come across Canvas demos that show drawing lines and whatnot, but nothing like providing some RGB arrays to produce something. Any guidance is greatly appreciated. Answer You can use the fillRect method, described here :
jquery sum of multiple input fields if same class in one input
Hello I need to sum the values of same class input in one input with class name total. Possible? A working fiddle here Answer You pretty much had it, just needed to adjust your JQuery a little bit for the appropriate selectors updated fiddle : http://jsfiddle.net/5gsBV/7/
Remove ‘All Files’ option from HTML file input
I am using <input type=”file”> to upload audio files. To do that I am using accept=”audio/*”. Because of this, the browser’s file-select dialog shows only audio files by default. However, there is an option called “All Files” in that dialog box that I don’t want. (note – Any solution in Javascript , jQuery and AngularJs is also welcome) How can