Found a total of 10000 related content
Embed Interactive jsFiddle Snippets on your Web Page
Article Introduction:Embed interactive jsFiddle code snippets on web pages to make your web page more interactive! This article will guide you how to implement this feature easily.
step
Visit jsfiddle.net to create your code snippet.
Click "Share" > "Embed Code" (embed as an iframe) in the menu bar.
Copy the generated iframe code into your webpage HTML.
Demo
Here is a demonstration of jsFiddle embedding. You can switch options such as js, css, etc. and run the code in real time on the page, just click the play button!
Enjoy the fun of jsFiddle! You may also be interested in:
Hide your jQuery source code
J
2025-02-25
comment 0
967
jQuery Get Current Page URL
Article Introduction:Complete Guide to Getting Current Web Page URL with jQuery
This guide provides jQuery code snippets to get the full URL of the current web page and store it in a variable for use with other scripts. This URL is the same as the URL you see in the address bar.
The following code snippet demonstrates how to get the URL of the current page using jQuery and pure JavaScript:
$(document).ready(function() {
// Use jQuery
var url = $(location).attr('href');
// Using pure JavaScript
2025-03-04
comment 0
759
jQuery Change Current Page Title
Article Introduction:Although jQuery itself cannot directly modify web page titles, the same effect can be easily achieved using pure JavaScript. The following JavaScript code snippet can modify the full title of the current web page (i.e. the title displayed in the browser title bar):
document.title = 'New title';
FAQs about modifying page titles using jQuery (FAQs)
How to modify the title of a specific page using jQuery?
To modify the title of a specific page using jQuery, use the document.title property. This property allows you to get or set text in the title bar. Here is a simple example:
$(document).re
2025-03-04
comment 0
578
jQuery Get Current Page Title
Article Introduction:Gets the jQuery code snippet of the current web page title and store the title into a variable for use with other scripts. This title is displayed in the browser title bar.
Use jQuery to get the full title of the current webpage and store it in a variable for code snippets to work with other scripts:
jQuery(document).ready(function() {
// Use jQuery
var href = jQuery(location).attr('href');
jQuery('#this_title').html('>' href
2025-03-05
comment 0
1178
10 jQuery Language Translator Plugins
Article Introduction:Ten excellent jQuery translation plug-ins help you easily build multilingual websites! Web page translation can be easily implemented without modifying HTML code. The following recommended jQuery translation plug-in will help you easily integrate website translation functions and improve user experience.
jQuery Translator Plugin: Easily translate web pages into multiple languages ??without modifying HTML. Just add the script reference and initialize the plugin.
Source Code Demo
jTextTranslate: A translation plug-in based on jQuery: This plug-in uses the Google language API and supports text translation in all languages ??provided by the API.
Source Code Demo
SundayM
2025-03-02
comment 0
681
Get GeoLocation using jQuery (API) GeoPlugin
Article Introduction:jQuery easily get the visitor's geographic location
jQuery combines the GeoPlugin API to easily obtain the geographical location information of website visitors, including country, region, city, and latitude and longitude coordinates (can be used in Google Maps). This service is completely free! The following example contains a warning box that facilitates you to verify functionality:
How to use:
Copy the following jQuery code into the web page's tag.
Copy the following HTML code into the tag of the web page.
Run to view the effect!
jQuery code:
jQuery(document).ready(function($) {
alert("Your location: &quo
2025-03-05
comment 0
1153
jQuery Encode/Decode URL String
Article Introduction:Simple jQuery code snippet to encode/decode (convert) a href params in a url string (http address) so that they can be properly viewed on a web page. For example, is the html equivalent of a space and @ is an ampersand (@).
Encode URL String
2025-03-04
comment 0
880
jQuery Check if Window is in iFrame
Article Introduction:Simple JavaScript code to determine whether a web page is in an iframe
Here is a simple JavaScript code snippet to check if the window is in an iframe. It is useful for some functions that may use URLs in the page's address bar. The code is as follows:
var isInIframe = (window.location != window.parent.location) ? true : false;
Related readings:
Get the source href injected iframe
How to reload an iframe
About jQuery and iframe
2025-03-06
comment 0
845
A Comprehensive Look at Events in jQuery
Article Introduction:This article was reviewed by Wern Ancheta and Camilo Reyes. Thanks to all the peer reviewers at SitePoint for getting SitePoint content to its best!
jQuery is able to capture almost all user interaction behaviors in a web page and define it as events. The importance of events is that they allow you to respond accordingly based on the actions of the user. For example, you can write code to change the background color of a web page based on button clicks or scroll events.
jQuery has many shortcut methods, such as contextmenu(), hover() and keyup(), used to handle different events. In addition to special methods, jQuery also provides a general on
2025-02-18
comment 0
569
Social Login for Your SPA: Authenticate Your Users via Google and Facebook
Article Introduction:The number of web applications in a single-page application architecture is increasing. This type of application loads the entire application into the browser as JavaScript. All interactions with the server are performed through an HTTP-based API that returns JSON documents. These applications often require some degree of user-restricted interaction, such as storing user profile details. Implementing this functionality in traditional HTML-based applications is relatively simple, but it is even more tricky in single-page applications that require authentication for each API request.
This article will demonstrate a technique that uses the Passport.js library to implement social logins for multiple providers and thereby implement token-based authentication of subsequent API calls.
All source code for this article is available from our Git
2025-02-16
comment 0
719
Building a Basic Web Application with Flask Python
Article Introduction:Flask is a lightweight framework in Python suitable for quickly building web applications. 1. After installing Flask, create an app.py file as the main program; 2. Write code to implement the "HelloWorld" page, access the local server to view the effect by running scripts; 3. Add multiple static pages or use dynamic routing to support variable delivery; 4. Use the Jinja2 template engine to render HTML pages and realize dynamic content display. The entire process gradually expands from basic examples to multi-page applications, reflecting Flask's flexibility and ease of use.
2025-07-07
comment 0
424
jQuery Check if an Element Exists
Article Introduction:Use jQuery to efficiently check whether HTML elements exist
This article provides a variety of jQuery code snippets to check whether HTML elements exist in the current web page. The easiest way is to check the length of the object and determine whether it exists in the DOM.
Method 1: Use the length attribute
// Check if the element exists
if ($("#id").length) {
// The element exists
}
// Or check if the length is zero
$('element').length == 0; // The element does not exist
// Or use native JavaScript
document.getElemen
2025-03-04
comment 0
446
Dave The Diver: How To Catch Spider Crabs
Article Introduction:In Dave The Diver, there are some creatures that are not easy to catch. Or, catch alive that is. The spider crab is one of those very species, making it seem like the only way to bring these crustaceans back up to land is to viciously crack them up w
2025-01-10
comment 0
809
Prepare for Interview Like a Pro with Interview Questions CLI
Article Introduction:Prepare for Interview Like a Pro with Interview Questions CLI
What is the Interview Questions CLI?
The Interview Questions CLI is a command-line tool designed for JavaScript learners and developers who want to enhance their interview
2025-01-10
comment 0
1437
Soft Deletes in Databases: To Use or Not to Use?
Article Introduction:Soft Deletes: A Question of DesignThe topic of soft deletes, a mechanism that "flags" records as deleted instead of physically removing them, has...
2025-01-10
comment 0
1052