August 14, 2011

$(“.class”) returns object

jQuery $(“.class”) returns object

<html>
<head>
<script type=”text/javascript” src=”js/jquery.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“label”).mousout(function(){
$(“.divClass”).hide();
});
});
</script>
</head>
<body>

<h3 class=”divClass”>Hello world! text</h3>
<p class=”divClass”>Hello world paragraph text.</p>
<p>This is another paragraph.</p>
<label>Try to mouseover and then mouseout on here</label>
</body>
</html>

Observed:
JQuery $(“.class”) returns object as we have
var obj = document.getElementByClassName(‘domObjClasses’);

But this returns array.

var obj = document.getElementById(‘domObjId’);

Here we will have an object by Id.

Last updated: March 19, 2014