Javascript
for
beginners

> Want to learn JavaScript but don't have the right resources?
Want to share your knowledge in your language!
You're in the right place.

Read. Create. Comment.

WRITE

CATEGORY: JavaScript
Javascript

Events: bubbling i capturing


When an event occurs on a page, the interpreter does not execute it immediately on the element where it happened (the target element). Instead, it travels to the root element through the DOM model, triggering all identical events along the way. This process is how browsers handle events. This journey is called event propagation. Event propagation consists of two phases: Capturing phase – The interpreter starts traveling from the root element to the element where the event occurred. Bubbling phase – The interpreter...

Read more
Created: 02/28/2019Comments:1Views: 14
Javascript

JavaScript Form Validacija


JavaScript Form Validation When performing JavaScript validation, you first need to disable the default constraint validation performed by the browser by adding the boolean attribute novalidate to the <form> element. This prevents the browser from automatically validating the form when the submit button is clicked, disables the display of special styles for valid and invalid forms, and ignores validation-related attributes in form elements. // You can also dynamically add this attribute using JavaScript and the noValidate property: document.getElementById("myForm").noValidate = true; In addition to novalidate, you can use the formnovalidate attribute in a button or input element...

Read more
Created: 02/28/2019Comments:0Views: 6
Javascript

Scope


Variables and functions defined outside of a function have a global scope. The global scope in JavaScript is the widest possible scope. It exists across the entire web page, and all variables and functions created in the global scope can be used anywhere on the page. In addition to variables, functions can also have a global scope. These are functions defined in the code itself, not within another function. Global variables and functions exist throughout the entire page and remain relevant as long as the user does not navigate to another page. Besides the global scope, there is also the functional or...

Read more
Created: 02/28/2019Comments:2Views: 22
Javascript

Fuction expression


In JavaScript, a function is treated as a value, meaning it can be used in place of any other value. A function can also be declared by assigning it to a variable, thereby giving the function the name of the variable it is assigned to. In other words, the variable becomes the function. These types of functions are called anonymous functions. However, we can also assign a name to such functions, which is useful when creating self-invoking functions. For these functions, a semicolon is required at the end. This method is used when the function is needed only once or when...

Read more
Created: 02/28/2019Comments:0Views: 9