If i post with stackoverflow, the loader will be displayed on the button, right?
I want to do the same thing, but I'm wondering if I should always put
Should we unify to include
in any case?
Or should it only be displayed if I want to see the loader?
Personally, I think it would be easier to understand if the text color is always unified with button>p in CSS, so I'm always thinking of putting
, but I would appreciate any advice.Example
Assuming there is a normal button like this
<button type = "button"> <span></span> Send </button>
The idea is to append the loader with jQuery as follows when clicked
var loadingAnimation =' ・ ・ ・ '; $("button.send"). append (loadingAnimation);
With this alone, the animation of "..." will be overlaid on the text of "Send", but it seems that the "Send" button is displayed.
So we came to the conclusion that the "send" text should be enclosed in
<button type = "button"> <span></span> <p>Send</p><!-Enclose here in<p>-> </button>
This allows you to hide the
in jQeury and display only the "..." animation.
var loadingAnimation =' ・ ・ ・ '; $("button.send"). append (loadingAnimation); $("p"). css ('display':'none');// hide<p>
Answer # 1
The markup structure is determined according to the specifications.
Like your question
button>pIf you are worried about the structure of (parent-child relationship of elements), please practice "How to check and judge with MDN".
It is a method to decide by comparing the "permitted content" of the element you want to be the parent element and the "content category" of the element you want to be the child element.
Search Google with the keyword "" to open the MDN page).
Content Category: Flow Content, Perceptible Content
button>pCan be judged to be incorrect usage.
The HTML5 specification is defined from the viewpoint of semantics, and it is thought that the search site is also used as a reference for algorithm development, so if you want to "index", you can use it as an alternative element.
It's a good idea to specify CSS as class, using.