JQuery: Get/Load Element by ID (or) Clases with spaces - Sample code

In Jquery we allowed accessing the element by its class or ID. If we use the help of class means the '.'(dot) followed by class name will help us to access the information. If we use ID means, the '#'(hash) followed by ID name help us to load the element object. The below is the accessing element property.

Without Space:
Syntax:

jQuery('.CLASSS NAME'); // Accessing using class.
jQuery('#ID NAME'); // Accessing using class.

Example:

var accessClass = jQuery('.name-wrapper'); // Accessing using class.
var accessId = jQuery('.student_name'); // Accessing using ID.

With Spaces:

If there is a chance of accessing the information using the ID or class with class means we have to follow notations.

Syntax:

var accessClass = jQuery('.CLASS NAME 1.CLASS NAME 2.CLASS NAME 3'); // Accessing using class having space.
var accessId = jQuery('[id="ID NAME"]'); // Accessing using ID having space.

Example:

var accessClass = jQuery('.name.wrapper'); // Accessing using class having space.
var accessId = jQuery('[id="student name"]'); // Accessing using ID having space.

Similar Examples

$("[id='student name']").trigger('click');
$("[id='student name']").val();

HTML:

< input type="text" value="Arunkumar Kuppuswamy" id="student name" class="name wrapper">
Category: