• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Archives for JavaScript

JavaScript

AJAX – Submit data with POST request into a MySQL database

GitHub

To make it work you will need to create a database in phpMyAdmin.

HTML

PHP

JS

Filed Under: JavaScript Tagged With: Ajax, PHP, SQL

AJAX request – JSON local file

Request single JSON data

Demo
GitHub

Request array JSON data

Demo
GitHub

Filed Under: JavaScript Tagged With: Ajax, json

AJAX request – TXT file

With Ajax You can receive data asynchronously without page reload.

Method 1 – onload function

GitHub

Method 2 – readystate function

Write text from TXT file in a specific div with AJAX

Demo
GitHub

Filed Under: JavaScript Tagged With: Ajax

jQuery – Add class / remove class

Filed Under: JavaScript Tagged With: jQuery

Disable right click with JavaScript

If You want to protect your website content by prevent right click there is a single line of JavaScript code to do it:

Filed Under: JavaScript Tagged With: click

Add “sticky” class to header when scrolling window

Filed Under: JavaScript Tagged With: sticky

JavaScript toggle add class / remove class

If You have multiple elements and do You want to set an active class only the clicked item. You can control with this snippet for instance a size selector on a webshop’s product page.

If You have only one element and do You want to control a menu dropdown toggle:

Method 1

Method 2

HTML

Method 3

Filed Under: JavaScript

JavaScript toggle to add “active” class

HTML

JavaScript

Filed Under: JavaScript Tagged With: toggle

iPad layout scales up when rotating from portrait to landscape

Orientation change on Apple devices causes a zoom in effect in the browser.

This snippet will solve this problem:

Filed Under: JavaScript Tagged With: ipad

Reload the page after click Add to cart button with 3 sec delay

Filed Under: JavaScript

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Go to Next Page »

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved