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.
$().ready(
function
() {
2.
$(
'#add'
).click(
function
() {
3.
!$(
'#select1 option:selected'
).appendTo(
'#select2'
);
4.
});
5.
$(
'#remove'
).click(
function
() {
6.
!$(
'#select2 option:selected'
).appendTo(
'#select1'
);
7.
});
8.
});
1.
$(document).ready(
function
(){
2.
$(
"#checkboxall"
).change(
function
(){
3.
var
checked_status =
this
.checked;
4.
$(
"input[name=checkall]"
).attr(
"checked"
, checked_status);
5.
});
6.
7.
});
1.
$(document).ready(
function
() {
2.
var
pathname = window.location.pathname;
3.
});
01.
$(
function
() {
02.
$(document).keypress(
function
(e){
03.
switch
(e.which){
04.
// "ENTER"
05.
case
13:
06.
alert(
'enter pressed'
);
07.
break
;
08.
09.
// "s"
10.
case
115:
11.
alert(
's pressed'
);
12.
break
;
13.
14.
(...)
15.
16.
}
17.
});
18.
19.
});
1.
$(
'#target div:not(#exclude)'
).hide();
2.
//or
3.
$(
'#target'
).children().filter(
':not(#exclude)'
).hide();
1.
$(
'element'
).bind(
'resize'
,
function
(){
2.
alert(
'Height changed to'
+ $(
this
).height() );
3.
}
1.
$(
'someTableSelector'
).find(
'tr:gt(0)'
).remove();
1.
1 level:
2.
$(
'*:not(* *)'
);
3.
2 level:
4.
$(
'*:not(* *)'
).find(
'> *'
);
5.
3 level:
6.
$(
'*:not(* *)'
).find(
'> * > *'
);
1.
var
foundin = $(
'*:contains("some string bla bla")'
);
1.
alert($(document).scrollTop());
- Sent (0)
- New