Found 10711 Articles for Web Development

Should I include language="javascript" in my SCRIPT tags?

mkotla
Updated on 30-Sep-2019 07:42:16

358 Views

The language attribute in JavaScript is optional since the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers. Therefore, now adding javascript isn’t required in tag.This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.Here you can see how it is used:                              

Should I include type=“text/javascript” in my SCRIPT tags?

Giri Raju
Updated on 12-Sep-2019 08:38:14

2K+ Views

The type attribute in JavaScript is optional since the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers. So, now adding text/javascript isn’t required in tag.This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".Here you can see how it is used:                              

What is the difference between id and name attributes in HTML?

Bhanu Priya
Updated on 04-Oct-2023 16:27:25

1K+ Views

ID attribute ID is an input form element, and it has nothing to do with data contained within the element. Input element ids are for hooking the element with JavaScript and CSS. By using id attribute, we can validate and manipulate the value of an element at client side. In java script, using id attribute we can get the value of input element. document.getElementById("id").value; In CSS, ID attribute is referenced with # character. #id If we consider HTML elements, the ID attribute is unique identifier, it is a case sensitive and begins with a letter, In ... Read More

How to use case-insensitive switch-case in JavaScript?

usharani
Updated on 03-Jan-2020 06:20:08

1K+ Views

To use case-insensitive switch-case in JavaScript, make the input all upper or all lowercase.ExampleYou can try to run the following code to learn how to use a case-insensitive switch:           JavaScript Strings                      var str = "amit";          str = str.toUpperCase();          switch (str) {             case 'AMIT': document.write("The name is AMIT ");             break;             case 'JOHN': document.write("The name is JOHN ");             break;             default: document.write("Unknown name")          }          document.write("Exiting switch block");          

How to do case-sensitive string comparison in JavaScript?

Shubham Vora
Updated on 26-Oct-2022 08:33:18

3K+ Views

This tutorial will guide you to learn case-sensitive string comparison in JavaScript. JavaScript is case-sensitive. Keywords, variables, function names, and any identifiers in JavaScript must be in the required case. For example, for keyword cannot be written as For or FOR. What are strings in JavaScript? A string is a collection of one or more characters, which could be letters, numbers, or symbols. Strings are immutable primitive data types in JavaScript, which implies they can never change. Text can be stored and modified using JavaScript strings. Any number of characters enclosed in quotations is a JavaScript string. How can we ... Read More

Why is JavaScript case sensitive but HTML isn't?

varun
Updated on 12-Sep-2019 08:28:32

295 Views

A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently. JavaScrip has a strict syntax to process the client-side-scripts written in JavaScript.Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in ... Read More

Why is case sensitivity so much more important in JavaScript?

Prabhas
Updated on 30-Sep-2019 07:41:32

74 Views

A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword, should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently.Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in JavaScript. For example, HTML onclick event attribute is mentioned as onClick in ... Read More

What is the difference between HTML tags <div> and <span>?

Bhanu Priya
Updated on 04-Oct-2023 16:21:13

2K+ Views

We can use both DIV and SPAN tags as a Container, as they both have their own specialty. Both are HTML5 tags. First let us discuss about DIV Tag in detail with examples. DIV TAG DIV helps in separating the data like text, images, navigation bar etc., we can also create particular sections by using the DIV tag, it consists of open and close tags , both open and close tags are compulsory if we want to divide the page. DIV tags can be styled with CSS or manipulated with JavaScript, it is easily styled by using the class ... Read More

What are valid values for the id attribute in HTML?

Bhanu Priya
Updated on 04-Oct-2023 15:54:16

955 Views

The ID attribute in HTML is called as unique identifier for the element. It helps in identifying an area in a web page by using CSS styles, targets for scripts and anchor links. First let us see, what is the use of ID attributes in HTML − The ID attribute can perform different actions on web pages by using commands − ID attribute used to reference for scripts − In JavaScript functions, we use ID attribute for making changes to the precise element on the page with our scripts. ID attribute use for style sheet selector − Most of ... Read More

What is the difference between “lang” and “type” attributes in a script tag?

Arushi
Updated on 12-Sep-2019 08:31:25

161 Views

JavaScript lang attributeThis attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.JavaScript type attributeThis attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".Here you can see how it is used:Live Demo                              

Advertisements