difference?
$(document).ready(...); //jquery's
and
window.onload();
answer
ready event occurs after the HTML document has been loaded,
while the onload event occurs later, when all content (e.g. images)
also has been loaded
difference?
$("li:parent");
$("li.parent");
$("li").parent();
$("li").parents();
how to select elements inside a DOM element?
var myDomElement = document.getElementById( "myId" );
// select all anchor tags inside myID
answer
$(myDomElement).find('a');
how to test whether an element has a particular class?
answer
$("#myDiv").hasClass( "someClass" );
output?
function func1()
{
return {
type: "ABC"
};
}
function func2()
{
return
{
type: "ABC"
};
}
console.log(func1());
console.log(func2());
output?
function func1() {
var a = b = 3;
}
func1();
console.log(a);
console.log(b);
output?
console.log(1.1 + 2.2);
console.log(1.1 + 2.2 == 3.3);
answer
3.3000000000000003
false
output?
console.log(1);
setTimeout(function(){console.log(2)}, 1000);
setTimeout(function(){console.log(3)}, 0);
console.log(4);
output?
console.log(2 + "2" + "2");
output?
console.log(2 + +"2" + "2");
output?
console.log(false == '0');
output?
console.log(false === '0');
which is more efficient?
document.getElementById( "someId" );
or
$( "#someId" );
difference?
$('#myDiv').detach();
$('#myDiv').remove();
how can you make a div round?
answer
$( "#myDiv" ).css("border-radius", "50%");
how to determine the state of a toggled element?
answer
$( "#myDiv" ).is( ":visible" );
$( "#myDiv" ).is( ":hidden" );
how to change the src attribute of an image at run-time?
answer
$( "img#myDiv" ).attr("src", "NEW_SRC_PATH");