Wrox Programmer Forums
BOOK: Beginning JavaScript 4th Edition
This is the forum to discuss the Wrox book Beginning JavaScript, 4th Edition by Paul Wilton, Jeremy McPeak; ISBN: 978-0-470-52593-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript 4th Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 27th, 2011, 12:59 AM
Registered User
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default "type" attribute in <script> tag

Is the "type" attribute important enough to basically always include in your opening <script> tag, or can it be optional these days. I've heard a couple different opinions on this - both strict and non-strict views actually. What's the best practice in majority of serious professional work environments?
Old August 30th, 2011, 08:54 AM
jmcpeak's Avatar
Wrox Author
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts

Howdy, Latinsteps.

If validation is important to you, and your documents are HTML 4.01 or XHTML, yes, type is required. If your document is HTML5, then no.

The type attribute was important a few years ago because without it, Internet Explorer had to guess what scripting language you used in a particular script element. Since IE7 or IE8, the type attribute defaults to text/javascript. So ultimately no, it's not required (unless validation is important to you).
Old September 6th, 2011, 01:29 AM
Registered User
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Jeremy,

Thank you for a typically clear explanation, and thank you for the very thoughtful sequence of instruction in your book, and the lucid prose that makes it such a terrific book!

Similar Threads
Thread Thread Starter Forum Replies Last Post
<%@ MasterType virtualPath="~/EAD_EditGrid.master"%> not recognised MattHoff BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 1 July 27th, 2010 10:21 AM
"type" attribute missing in $pres() responce senpai BOOK: Professional XMPP Programming with JavaScript and jQuery 11 April 21st, 2010 12:14 PM
<input type="Checkbox" question??? RinoDM HTML Code Clinic 1 October 26th, 2009 06:00 AM
<deployment retail="true"> clarification jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 October 1st, 2009 02:48 PM
<authentication mode="Forms"/> msman88 ASP.NET 3.5 Professionals 10 August 30th, 2009 08:57 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.