In: Computer Science
1. What is the translation of the following jQuery statement?
if($('input.firstname').val() == "Bob"){
$('select').attr('disabled', true);
}
If an input with the class 'firstname' has a value equal to 'Bob', disable all dropdown boxes. |
||
If an input with the type 'firstname' has a value equal to 'Bob', select all elements with a 'disabled' attribute. |
||
I have no idea what this means. |
||
If all inputs have a value equal to Bob, disable all dropdown boxes. |
2. Which javascript function can be used to display content in the browser?
echo() |
||
document.print() |
||
document.write() |
||
printf() |
3. Which of the following is NOT a comparsion operator?
=== |
||
!= |
||
< |
||
= |
4. To specify where a link should go once it is clicked, the ___ attribute of the <a> tag must be specified.
type |
||
href |
||
src |
||
rel |
1. If an input with the type 'firstname' has a value equal to 'Bob', select all elements with a 'disabled' attribute.
Reason - In the if statement, we are checking if the value of firstname is "Bob", then we are selecting all attributes whose disabled field is true. Meaning, selecting all elements with a disabled attributes.
2. document.write() function can be used to display the
content in browser.
Reason - Javascript can display data in browser as follows :
a. Writing into HTML output using
document.write()
b. echo() is a statement used to display text in php.
c. printf() is used to display text in C language.
3. '=' is not a comparison operator.
Reason -
a. != - It is a comparison operator called "not equal to". It
checks for inequality.
b. < - It is a comparison operator called "less than".
c. === - It is a comparison operator used for equality comparison.
This operator tests for strict equality. Means, It will not do the
type connversion. Hence, if two values are not of same type when
compared, it will return false.
d. = - It is an assignment operator. It is used to assign
values to variabes or identifiers. For x, "x = 10".
4. To specify where a link should go once it is clicked,
the href attribute
of the <a> tag must be specified.
Reason -
a. type - The type attribute is used to specify the Internet media
type of a script.
b. src - The src attribute is used to specify the URL of the media
file to play. For example, this attribute will be required when
source is used in ausio and video.
c. rel - The rel attribute defines the relationship between a
linked resource and the current document.
d. href - It is an attribute of the anchor tag. It contains
two sections, the URL which is the actual link where it should go
and the clickable text that appears on the page, known as anchor
text.