9) How to show the alert message on button click in Jquery?
Jquery is one of the most powerful libraries what we have and it provides event handling. This scenario can be handled by “OnClick” of the button. Below is the code snippet –
<input type=”button” id=”myButton” onclick=”alert(‘Hi’)” />
10) What is the meaning of Selectors in Jquery?
In javascript we have several methods to find the controls like – “getElementByName” and “getElementByID”, which is used to find the control based on Name of the control and ID of the control respectively. Similarly in Jquery we have find the controls using selectors. Below are some of the selectors -
- “*” - To Find all the elements of the page.
- “#” – Used to find the control by ID.
- “.” - Used to find the control by Class.
11) In ASP.NET, Jquery will be added in Content and Master pages both?
No. If the Jquery file added in master page then content pages will going to use that.
12) What is the advantage of using minified version of Jquery?
Advantage of using minified verison of Jquery will mainly be performance. Size of the minified jquery file will be around 76KB where as the normal Jquery file size will be around 180KB.
13) Can you give an example of selecting an element based on its class name ?
Below is the sample code snippet –
$(‘.MyControl’).Hide()
14) What are the difference between “Length” and “Size” in Jquery?
Both are used to find number of elements in an object. “Length” will be used commonly because it’s faster compared to “size” because “length” is a property and “size” is a method.
15) How can we set the page title in Jquery?
Below is the code snippet used to set the page title -
$(function(){ $(document).attr(“title”, “A4 Academics”); });
16) What is the use of Jquery Connect?
Connect method is used to bind one function to another and it’s used to execute the function when a function is executed from another object.
17) How to use AJAX in Jquery?
Jquery supports AJAX calls, below is the code snippet of AJAX in Jquery –
$.ajax({ url: ‘MyURL', success: function(response) { //My Code goes here }, error: function(err) { //My Code goes here } });
No comments:
Post a Comment