This free HTML JavaScript tutorial provides 45+ JavaScript/jQuery tips and tricks that help you work in JavaScript tasks better, through live HTML JavaScript example codes. List of some JavaScript tips and tricks:
- Refreshing the src of an image with jQuery?
- Check if an image is loaded or not with jQuery
- Remove selected text after mouse double click JavaScript event
- Validate an email address
- Check if an HTML control element exists
- Cancel an AJAX request
- Select all HTML checkboxes
- Selecting root element of a certain level in the document
- Searching a string in jQuery
Please go to the full post page for full detailed tips and HTML JavaScript example codes, then try some JavaScript tutorials:
- 10 Small Javascript Tricks You Should Master
- Some Basic Tips and Tricks for Speeding Up JavaScript
- 10 jQuery and JavaScript Tips and Tricks to Improve Your Code
- 5 Good and Small JavaScript Tips and Tricks
- Demo
- Enlarge
- Reload
- New window
Generate your business videos by AI with voice or just text
Your first FREE AI Video App! Automate Your First AI Video. Create Your Professional Video In 5 Minutes By AI No Equipment Or Video Editing Skill Requred. Effortless Video Production For Content Marketers.
1.
$(
'* :not(.someclass)'
)
1.
$(
'#myTable tr:last'
).after(
'<tr>...</tr>'
);
1.
num = num.toString(16);
2.
reverse process:
3.
num = parseInt(num, 16);
1.
var
elements = $(
'#someid input[type=sometype][value=somevalue]'
).get();
1.
var
date =
new
Date();
2.
date.setTime(date.getTime() + (x * 60 * 1000));
3.
$.cookie(
'example'
,
'foo'
, { expires: date });
1.
example: first 10 anchors
2.
$(
'a'
).slice(0,10);
3.
//or
4.
$(
'a:lt(10)'
);
1.
//Get the value of a selected option
2.
$(
'selectElement'
).val();
3.
4.
//Get the text of a selected option
5.
$(
'#selectElementId :selected'
).text();
6.
7.
//Remove an option (e.g. id=1)
8.
$(
"#selectElementId option[value='1']"
).remove();
1.
$.getJSON(
"http://jsonip.appspot.com?callback=?"
,
function
(data){
2.
alert(
"Your ip: "
+ data.ip);
3.
});
file.xml:
01.
<?
xml
version
=
"1.0"
?>
02.
<
result
>
03.
<
item
>
04.
<
id
>1</
id
>
05.
<
title
>title1</
title
>
06.
<
description
>desc1</
description
>
07.
</
item
>
08.
<
item
>
09.
<
id
>2</
id
>
10.
<
title
>title2</
title
>
11.
<
description
>desc2</
description
>
12.
</
item
>
13.
<!-- ... -->
14.
</
result
>
01.
$.get(
'file.xml'
,{},
function
(data){
02.
$(
'item'
,data).each(
function
(){
03.
var
$
this
= $(
this
);
04.
var
id = $
this
.find(
'id'
).text();
05.
var
title = $
this
.find(
'title'
).text();
06.
var
description = $
this
.find(
'description'
).text();
07.
//do something ...
08.
});
09.
});
1.
<
div
id
=
"sites"
>
2.
<
a
id
=
"site_1"
href
=
"http://siteA.com"
>siteA</
a
>
3.
<
a
id
=
"site_2"
href
=
"http://siteB.com"
>siteB</
a
>
4.
<
a
id
=
"site_3"
href
=
"http://siteB.com"
>siteC</
a
>
5.
...
6.
</
div
>
you need to get 1 from site_1, 2 from site_2 ...
1.
$(
"#sites a"
).click(
function
(){
2.
var
$
this
= $(
this
);
3.
var
nmb = $
this
.attr(
'id'
).match(/site_(\d+)/)[1];
4.
...
5.
});
- Sent (0)
- New
Generate your business videos by AI with voice or just text
chatGPTaz.com
Talk to ChatGPT by your mother language
AppAIVideo
Your first FREE AI Video App
Deepfake Video
Deepfake AI Video Maker
Deepfake
Deepfake AI Video Maker
AI Deep Fake
Deepfake AI Video Maker
AIvidio
AI Video Mobile Solutions
AIvideos
AI Video Platform & Solutions
AIvedio
AI Video App Maker
Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)
Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)
Faceswap AI Online
Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE
Faceswap AI Online
Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE
Faceswap AI Online
Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE
Powerful AI Presentation PPT Maker for FREE
Build an impressive presentation with our free online AI presentation app
Your next top AI Assistant
Claude AI, developed by Anthropic
Your next top AI Assistant
Claude AI, developed by Anthropic
Temu Free $500 for New Users
Claim Free Temu $500 Credit via Affiliate & Influencer Program
Free TikTok Ads Credit
Master TikTok Ads for Your Business Marketing
Dall-E-OpenAI.com
Generate creative images automatically with AI
chatGPT4.win
Talk to ChatGPT by your mother language
First AI Product from Elon Musk - Grok/UN.com
Speak to Grok AI Chatbot with Your Language
Tooly.win
Open tool hub for free to use by any one for every one with hundreds of tools
GateIO.gomymobi.com
Free Airdrops to Claim, Share Up to $150,000 per Project
iPhoneKer.com
Save up to 630$ when buy new iPhone 16
Buy Tesla Optimus Robot
Order Your Tesla Bot: Optimus Gen 2 Robot Today for less than $20k