-2
Next, I have a series of dynamically created Lis. What I need to do with pure JS is simply find the son of the father div.
Here’s how it works: When a date has an unavailable time the system warns.
The date is i parent ID, and the children are Ids in hours.
With PURE Js (I’m learning why I want pure and not Jquery).
How to Browse and Find Child ID ?
<li style="display:none;" id="12-05-2016">Para o dia: 12-05-2016
<ul><li id="08:00"> Esta hora esta indisponivel: 08:00</li></ul>
<ul><li id="09:00"> Esta hora esta indisponivel: 09:00</li></ul>
</li>
<li style="display:none;" id="13-05-2016">Para o dia: 13-05-2016
</li>
How do you know what to look for? You will look for the child element by
id
? and where do you know if you should look for08:00
or by09:00
?– Sergio
That part’s no problem.
– Uriel
With Js I get the elements. From date and time. Just need to compare the date (id) to the time (id daughter)
– Uriel
I didn’t get your answer. What are you looking for in the child elements? If you want to know all you can use
elemento.children
. If you’re looking for one, specific, what do you look for in it? for in that case there may be a more correct answer.– Sergio
Will always be a specific.
– Uriel
@Very badly done Uriel this relation of Id. Can improve by putting something statical, example "data_12-05-2016" , "hora_08:00" .
– Matheus
@Uriel takes another look at my questions here in the comments. You understand what I’m trying to clarify and it’s not clear to me in your question?
– Sergio
Sergio, the question is very simple. I want to check if a date has an hour inside. The date is an ID the time that is inside tbm is. Via JS I take the date field and its value. Then pick up from the time field its value. .
– Uriel
@Uriel then you have in a variable the time you want and you need to find the child element that has that time as
id
that’s it?– Sergio
The problem has been solved
– Uriel
@Uriel ok, great. I still think there are doubts and that you could better understand your problem. If you want to learn and understand the problem better give feedback to questions from experienced people who want to help you.
– Sergio