JQuery UI interview question

Question: 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.

  Question: 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


Question: 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


Question: In which language, JQuery UI is written?
JavaScript

Question: Is JQuery UI opensource?
Yes.
Question: What is current stable version of JQuery UI?
1.11.4 / dated 11 March 2015

Question: From where we can download the jQuery UI
https://jqueryui.com/

Question: Can we download custom widgets from jQuery UI
Yes, We can.
https://jqueryui.com/download/

Question: How to add CSS property on last div?

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


Question: 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.

Question: 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();


Question: How to remove close button on the jQuery UI dialog using CSS?

.ui-dialog-titlebar-close {

  visibility: hidden;

}


Question: 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(); }

});


Question: How to initialize a dialog without a title bar?

var dialogOpts=[]

$("#divId").dialog(dialogOpts);

//Remove the title bar

$(".ui-dialog-titlebar").hide();


Question: How to call Hook into dialog close event in jQuery UI?

$('div#contentId').on('dialogclose', function(event) {

     //console.log('closed event called');

 });


Question: 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

Question: 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


Question: How can I disable a button in a jQuery ?

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


Question: How do I keep jQuery UI Accordion collapsed by default?

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


Question: How to call a dragable widget?

// Make #draggable draggable

$(function () {

        $("#draggableDivId").draggable();

});


Question: 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

});


How to remove JQuery UI Autocomplete Helper text?

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


Question: How to set year in DatePicker?

 $(".datepickerClass").datepicker({

    yearRange: '1950:2013',

   changeMonth: true,

   changeYear: true,

   showButtonPanel: true,

  

});


Question: How to set current Date in Date Picker?

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


Question: How to Change Date Format in jQuery UI DatePicker?

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

 

JQuery UI interview question JQuery UI interview question Reviewed by Evergreen on 23:10 Rating: 5

No comments:

Powered by Blogger.