Logo F2FInterview

jQuery Interview Questions

Q   |   QA

function updateStatus() {
$.ajax({
url: ‘pcdsEmpRecords.php’,
success: function(response) {
// update div id Results
$(‘#results’).html(response);
}
});
}

Set the ‘disabled’ attribute to true or false:
// Disable #pcds
$(‘#pcds’).attr(‘disabled’, true);
// Enable #pcds
$(‘#pcds’).attr(‘disabled’, false);
Add or remove the ‘disabled’ attribute:
// Disable #pcds
$(“#pcds”).attr(‘disabled’, ‘disabled’);
// Enable #x
$(“#pcds”).removeAttr(‘disabled’);

There are two ways to check or uncheck a checkbox or radio button.
Set the ‘checked’ attribute to true or false.
// Check #pcds
$(‘#pcds’).attr(‘checked’, true);
// Uncheck #pcds
$(‘#pcds’).attr(‘checked’, false);
Add or remove the ‘checked’ attribute:
// Check #pcds
$(“#pcds”).attr(‘checked’, ‘checked’);
// Uncheck #pcds
$(“#pcds”).removeAttr(‘checked’);

Select elements typically have two values that you want to access. First there’s the value to be sent to the server, which is easy:
$(“#pcdsselect”).val();
// => 1
The second is the text value of the select. For example, using the following select box:
Mr
Mrs
Ms
DrProf
If you wanted to get the string “Mr” if the first option was selected (instead of just “1″), you would do that in the following way:
$(“#mpcdsselect option:selected”).text();
// => “Mr”

Dollar Sign is nothing but it's an alias for JQuery. Take a look at below jQuery code

$(document).ready(function(){

});

 

Over here $ sign can be replaced with "jQuery " keyword.

jQuery(document).ready(function(){

});

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: