Hello Salvador,
Please forgive me because my knowledge of HTML is limited.
The interface ICefDomDocument of CEF4Delphi has the function GetElementById but... what is an element and what is the relevant ID ? How can I find them in a .html page?
Many thanks
Alberto
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
GetElementById but what is an ID?
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: GetElementById but what is an ID?
Hi Alberto,
The definition of an "HTML element" according to w3schools is this :
HTML attributes provide additional information about HTML elements :
https://www.w3schools.com/html/html_attributes.asp
The ID is one of the attributes of all the html elements used to identify them in the document. Read this for more information :
https://www.w3schools.com/html/html_id.asp
The DOMVisitor demo loads this forum and tries to find the search box in the upper-right corner. That search box is in fact an INPUT element and you can see it in the HTML file like this :
As you can see, the INPUT element only has a start tag and inside the tag there is an "id" attribute with "keywords" as value.
The w3schools website has lots of useful information and tutorials about HTML and CSS. The links I mentioned belong to this tutorial in case you want to take a look :
https://www.w3schools.com/html/default.asp
The definition of an "HTML element" according to w3schools is this :
https://www.w3schools.com/html/html_elements.aspAn HTML element is defined by a start tag, some content, and an end tag.
HTML attributes provide additional information about HTML elements :
https://www.w3schools.com/html/html_attributes.asp
The ID is one of the attributes of all the html elements used to identify them in the document. Read this for more information :
https://www.w3schools.com/html/html_id.asp
The DOMVisitor demo loads this forum and tries to find the search box in the upper-right corner. That search box is in fact an INPUT element and you can see it in the HTML file like this :
Code: Select all
<input name="keywords" id="keywords" type="search" maxlength="128" title="Search for keywords" class="inputbox search tiny" size="20" value="" placeholder="Search…">
The w3schools website has lots of useful information and tutorials about HTML and CSS. The links I mentioned belong to this tutorial in case you want to take a look :
https://www.w3schools.com/html/default.asp
Re: GetElementById but what is an ID?
Hi Salvador,
Thanks for your answer. I suppose if there are two different elements with the same id, CEF4Delphi we’ll find the first, am I correct?
Alberto
Thanks for your answer. I suppose if there are two different elements with the same id, CEF4Delphi we’ll find the first, am I correct?
Alberto
- salvadordf
- Posts: 4304
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: GetElementById but what is an ID?
The ID value should be unique in the document.
I guess Chromium would return the first one if there are several elements with the same ID.
I guess Chromium would return the first one if there are several elements with the same ID.