Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by George John
Page 16 of 79
Place autofocus in the text box when a page gets loaded without JavaScript support in HTML?
The autofocus attribute is a boolean HTML attribute that automatically focuses on a specific input element when a page loads, eliminating the need for JavaScript. When present on an , , or element, the browser automatically places the cursor in that field, making it ready for user input immediately upon page load. Syntax Following is the syntax for the autofocus attribute − Alternatively, you can use the explicit boolean syntax − Basic Autofocus Example Following example demonstrates how the autofocus attribute works with a simple form ...
Read MoreHTML disabled Attribute
The disabled attribute in HTML is used to disable form elements, making them unclickable and unselectable. When applied, the element becomes inactive and cannot be interacted with by users. This attribute is commonly used with form controls like buttons, input fields, select options, and option groups. Syntax Following is the syntax for the disabled attribute − Or with a value − Elements Supporting Disabled Attribute The disabled attribute can be applied to the following HTML elements − − Disables button elements − Disables ...
Read MoreClearfix Bootstrap class
The Bootstrap .clearfix class solves the common issue of parent containers collapsing when all child elements are floated. It ensures the parent container properly wraps around its floated children. What is Clearfix? When elements are floated using .pull-left or .pull-right, they are removed from the normal document flow. This can cause their parent container to have zero height, leading to layout problems. The .clearfix class forces the parent to expand and contain its floated children. Example Here's how to use the .clearfix class to properly contain floated elements: ...
Read MoreHow to disable browser's back button with JavaScript?
To disable the browser's back button, you can use JavaScript's history.forward() method to prevent users from navigating backward. This technique forces the browser to stay on the current page when the back button is clicked. Basic Approach The core idea is to push the current page forward in history whenever the user tries to go back: Disable Browser Back Button Main Page Next Page ...
Read MoreChange the color of right border with CSS
The border-right-color CSS property allows you to change the color of an element's right border specifically, without affecting the other borders. Syntax border-right-color: color; Parameters The color value can be specified using: Color names: red, blue, green Hex values: #FF0000, #00FF00 RGB values: rgb(255, 0, 0) HSL values: hsl(0, 100%, 50%) Example: Basic Right Border Color .demo { border: 3px solid black; ...
Read MoreIs there a Microsoft equivalent for HTML5 Server-Sent Events?
HTML5 Server-Sent Events (SSE) provide real-time communication from server to client. While not natively supported in older Internet Explorer versions, there are Microsoft-compatible alternatives to achieve similar functionality. What are Server-Sent Events? Server-Sent Events allow a web page to receive automatic updates from a server through a persistent HTTP connection. Unlike WebSockets, SSE provides unidirectional communication from server to client only. if (typeof EventSource !== "undefined") { var source = new EventSource("/events"); source.onmessage = function(event) { ...
Read MoreHow to save HTML5 canvas data to file?
HTML5 canvas provides several methods to save canvas data to files. The approach depends on whether you're working in a browser or Node.js environment. Method 1: Browser Environment - Download as File In browsers, use toDataURL() or toBlob() to convert canvas data and trigger a download: Canvas Save Example Save Canvas // Draw something on canvas ...
Read MoreHow to "enable" HTML5 elements in IE 8 that were inserted by AJAX call?
To enable HTML5 elements in IE 8 that were inserted by AJAX calls, you need to use plugins like html5shiv and manually create elements using document.createElement. The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explorer 6-9. The Problem IE 8 doesn't recognize HTML5 elements like , , or . When these elements are inserted via AJAX, they won't render properly even with html5shiv loaded. Solution: Manual Element Creation You need to call document.createElement for each HTML5 element before inserting AJAX content: ...
Read MoreSet dashed line for border with CSS
To set the dashed line for the border, use the border-style property with the value dashed. This creates evenly-spaced dashes around the element's border. Syntax border-style: dashed; /* or combine with width and color */ border: width style color; Example This is a dashed border. Different Dashed Border Styles ...
Read MoreEscaping/encoding single quotes in JSON encoded HTML5 data attributes
When embedding JSON data in HTML5 data attributes, single quotes can break HTML parsing. JavaScript provides several methods to properly escape or encode single quotes to ensure valid HTML output. The Problem with Single Quotes in Data Attributes Single quotes inside JSON values can break HTML attribute parsing when the attribute itself uses single quotes: // Problematic - single quote breaks HTML
Read More