Top 23 Jqueryui Interview Questions You Must Prepare 24.Jun.2024

Q1. How To Call Hook Into Dialog Close Event In Jquery Ui?

$('div#contentId').on('dialogclose', function(event)
{
     //console.log('closed event called');
 }
);

Q2. Can We Use Another Variable Instead Of $ In Jquery? If Yes, How?

Yes, we can.
var jQ = jQuery.noConflict();
/** Now use jQ instead of $ **/
jQ( "div#pid" ).hide();

Q3. How To Set Year In Datepicker?

$(".datepickerClass").datepicker(
{
    yearRange: '1950:2013', 
   changeMonth: true,
   changeYear: true,
   showButtonPanel: true, 
}
);

Q4. What Is Current Stable Version Of Jquery Ui?

1.11.4 / dated 11 March 2015

Q5. How To Remove Jquery Ui Autocomplete Helper Text?

.ui-helper-hidden-accessible { display:none; }

Q6. How Do I Disable A Jquery-ui Draggable Of Widget?

//myObject is widget object.
myObject.draggable( 'disable' );

OR, you can set during the initalization 
$("#yourDialogId").dialog({
    draggable: false
});

Q7. In Which Language, Jquery Ui Is Written?

JavaScript

Q8. How To Call A Dragable Widget?

// Make #draggable draggable
$(function ()
{
        $("#draggableDivId").draggable();
}
);

Q9. How To "change Button Text" In Jquery?

jQuery Version < 1.6
$("#elementId").attr('value', 'Save'); //versions older than 1.6

jQuery Version > 1.6
$("#elementId").prop('value', 'Save'); //versions newer than 1.6

Q10. How Can I Disable A Button In A Jquery ?

$('#divId').attr("disabled", true);

Q11. How To Change Date Format In Jquery Ui Datepicker?

var date = $('#datepickerDivId').datepicker
(
{ dateFormat: 'dd-mm-yy'
}
).
val();

Q12. How To Add Css Property On Last Div?

$('div:last').css({backgroundColor: 'green', fontWeight: 'bolder'});

Q13. How To Download Jquery Ui Css From Google's Cdn?

Uncompressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js
Compressed: http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js

Q14. What Is Jquery Ui?

It is JavaScript Library which is collection of jQuery widgets like datepicker, tabs, autocomplete etc. We can also add effects, interactions (drag, drop, resize) on widgets.

Q15. How To Set Current Date In Date Picker?

$(".datepickerClass").datepicker('setDate', new Date());

Q16. What Widets Are Available In Jquery Ui?

  1. Accordion
  2. Autocomplete
  3. Button
  4. Datepicker
  5. Dialog
  6. Menu
  7. Progressbar
  8. Selectmenu
  9. Slider
  10. Spinner
  11. Tabs
  12. Tooltip

Q17. What Is $.noconflict()?

<script src="https://code.jquery.com/jquery-1.6.2.js" type="text/javascript"></script>
<script type="text/javascript">
$.noConflict()
</script>

When we call to $.noConflict(). Old references of $ are saved during jQuery initialization, noConflict() simply restores them.

Q18. How To Remove Close Button On The Jquery Ui Dialog Using Javascript?

$("#div2").dialog(
{
   closeOnEscape: false,
   open: function(event, ui)
{
$(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
}
}
);

Q19. How To Remove Close Button On The Jquery Ui Dialog Using Css?

.ui-dialog-titlebar-close
{
  visibility: hidden;
}

Q20. Is Jquery Ui Opensource?

Yes.

Q21. What Are Different Effects Available In Jquery Ui?

  1. Add Class
  2. Color Animation
  3. Easing
  4. Effect
  5. Hide
  6. Remove Class
  7. Show
  8. Switch Class
  9. Toggle
  10. Toggle Class

Q22. How Do I Keep Jquery Ui Accordion Collapsed By Default?

$("#divId").accordion
(
{
header: "h4", collapsible: true, active: false
}
);

Q23. How To Initialize A Dialog Without A Title Bar?

var dialogOpts=[]
$("#divId").dialog(dialogOpts);
//Remove the title bar
$(".ui-dialog-titlebar").hide();