Creating rounded corners using CSS [closed]

Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the border-radius property. You can read the spec on the property, or get some useful implementation information on MDN: If you are using a browser that doesn’t implement border-radius (Chrome pre-v4, Firefox pre-v4, IE8, Opera pre-v10.5, Safari pre-v5), then … Read more

OnChange event handler for radio button (INPUT type=”radio”) doesn’t work as one value

var rad = document.myForm.myRadios; var prev = null; for (var i = 0; i < rad.length; i++) { rad[i].addEventListener(‘change’, function() { (prev) ? console.log(prev.value): null; if (this !== prev) { prev = this; } console.log(this.value) }); } <form name=”myForm”> <input type=”radio” name=”myRadios” value=”1″ /> <input type=”radio” name=”myRadios” value=”2″ /> </form> Here’s a JSFiddle demo: https://jsfiddle.net/crp6em1z/

How can I prevent the backspace key from navigating back?

This code solves the problem, at least in IE and Firefox (haven’t tested any other, but I give it a reasonable chance of working if the problem even exists in other browsers). // Prevent the backspace key from navigating back. $(document).unbind(‘keydown’).bind(‘keydown’, function (event) { if (event.keyCode === 8) { var doPrevent = true; var types … Read more

‘innerText’ works in IE, but not in Firefox

Update: I wrote a blog post detailing all the differences much better. Firefox uses W3C standard Node::textContent, but its behavior differs “slightly” from that of MSHTML’s proprietary innerText (copied by Opera as well, some time ago, among dozens of other MSHTML features). First of all, textContent whitespace representation is different from innerText one. Second, and … Read more

How to Detect Browser Back Button event – Cross Browser

(Note: As per Sharky’s feedback, I’ve included code to detect backspaces) So, I’ve seen these questions frequently on SO, and have recently run into the issue of controlling back button functionality myself. After a few days of searching for the best solution for my application (Single-Page with Hash Navigation), I’ve come up with a simple, … Read more

Remove Safari/Chrome textinput/textarea glow

Edit (11 years later): Don’t do this unless you’re going to provide a fallback to indicate which element is active. Otherwise, this harms accessibility as it essentially removes the indication showing which element in a document has focus. Imagine being a keyboard user and not really knowing what element you can interact with. Let accessibility … Read more

JavaScript get clipboard data on paste event (Cross browser)

Solution #1 (Plain Text only and requires Firefox 22+) Works for IE6+, FF 22+, Chrome, Safari, Edge (Only tested in IE9+, but should work for lower versions) If you need support for pasting HTML or Firefox <= 22, see Solution #2. function handlePaste(e) { var clipboardData, pastedData; // Stop data actually being pasted into div … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)