How to make the cursor a hand when hovering in CSS?
Question
Having html below:
1 | <ul> |
How to make the cursor a hand when hovering the table?
Answer
Solution is below:
1 | li { |
Reference
This is the end of post
Having html below:
1 | <ul> |
How to make the cursor a hand when hovering the table?
Solution is below:
1 | li { |
This is the end of post
I have an object below:
1 | var thisIsObject= { |
I want to remove the key Dog
and its value. What should I do?
There are three ways to remove a key from an object.
1 | // Example 1 |
This is the end of post
Like photo above, how to remove the dotted outline when focusing to this element?
In other case, how to add this outline when focusing?
Add outline:none
this styling.
Solution is below:
1 | a:focus { |
This is the end of post
There is an object like below:
1 | var myObj = { |
And one array is var newArray = ['A', 'B'];
I want to add newArray
into arrayOne: []
, the result should be like below
1 | { |
What should I do?
There are two ways to add newArray
inside arrayOne
of myObj
.
obj.arrayOne.push(newArray);
obj['arrayOne'].push(newArray);
This is the end of post
There is a div as below.
1 | <div class="e">Wei Xia</div> |
How to change the background color when I hover those two element?
1 | .e:hover { |
By using :hover
will update the background color. You can view the demo below.
This is the end of post
Javascript 里的 For 循环有很多种,接下来我们一一来解析一遍。
这是最基础的用法,用 For loop 来遍历一个数组,如下所示:
1 | for (var index = 0; index < myArray.length; index++) { |
forEach 是 ES 5 里的一个用法,如下所示:
1 | myArray.forEach(function (value) { |
for...in
循环实际是为循环可枚举 (enumerable) 对象而设计的,如下所示:
1 | var obj = {a:1, b:2, c:3}; |
for ... of
是 ES 6 里的新用法,语法如下:
1 | for (var value of myArray) { |
for...of
的语法看起来跟 for...in
很相似,但它的功能却丰富的多,它能循环很多东西。
1 | let iterable = [10, 20, 30]; |
1 | let iterable = "boo"; |
1 | let iterable = new Uint8Array([0x00, 0xff]); |
1 | let iterable = new Map([["a", 1], ["b", 2], ["c", 3]]); |
1 | let iterable = new Set([1, 1, 2, 2, 3, 3]); |
1 | // Note: This will only work in platforms that have |
1 | function* fibonacci() { // a generator function |
This is the end of post
There is a div with an attribute data-value = "10"
.
Does there is anyway to get and update the data-value
value?
1 | <div id="mydiv" data-value="10"></div> |
1 | var a = $('#mydiv').data('myval'); //getter |
This is the end of post
Like title says, what is the order for the tabindex
attribute in html?
Code example:
1 | <input tabindex="3"> |
Order:
<span tabindex="4">This wouldn't normally receive focus</span>
has (4) largest value. Next tab will give focus to the rest of tabnavigable elements in code source order.
This is the end of post
My code is below:
1 | <li id="id_name" class="class_names"><a href="http://linktothepage.com/page" aria-label="TITLE OF MY PAGE">TITLE OF MY PAGE</a></li> |
I added aria-label
in the <a>
tag, but it doesn’t work with screen reader software.
What should I do?
aria-label
sometimes doesn’t work with JAWS in Windows PC. Need to use title
in <a>
tag instead.
The solution is:
1 | <li id="id_name" class="class_names"><a href="http://linktothepage.com/page" title="TITLE OF MY PAGE">TITLE OF MY PAGE</a></li> |
This is the end of post
There is a list as below.
1 | <ul> |
If I want to move A or B or C to the first place after clicking on it, what should I do?
By using JQuery method prepend
to make it happen.
Solution:
1 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> |
1 | $('ul li').click(function(event) { |
This is the end of post