button vs. input type=”button” /. Which to use?

Here’s a page describing the differences (basically you can put html into a <button></button>) And another page describing why people avoid <button></button> (Hint: IE6) Another IE problem when using <button />: And while we’re talking about IE, it’s got a couple of bugs related to the width of buttons. It’ll mysteriously add extra padding when you’re trying to add styles, meaning … Read more

HTML input – name vs. id

In HTML4.01: Name Attribute Valid only on <a>, <form>, <iframe>, <img>, <map>, <input>, <select>, <textarea> Name does not have to be unique, and can be used to group elements together such as radio buttons & checkboxes Can not be referenced in URL, although as JavaScript and PHP can see the URL there are workarounds Is referenced in JavaScript with getElementsByName() Shares the same namespace as … Read more

Disable/enable an input with jQuery?

jQuery 1.6+ To change the disabled property you should use the .prop() function. jQuery 1.5 and below The .prop() function doesn’t exist, but .attr() does similar: Set the disabled attribute. To enable again, the proper method is to use .removeAttr() In any version of jQuery You can always rely on the actual DOM object and is probably a little faster than the other two … Read more