I have a dropdown list which is populated by Javascript.
Whilst deciding what should be the default value to show on load, I realised that the following properties showed exactly the same values:
innerTextinnerHTMLlabeltexttextContentouterText
My own research shows bench marking tests or comparisons between a few of them, but not all.
I can use my own common sense and choose 1 or the other as they provide the same result, but, I'm concerned this is not going to be a good idea if the data were to change.
My findings are:
innerTextwill show the value as is and ignores any HTML formatting which may be includedinnerHTMLwill show the value and apply any HTML formattinglabelappears to be the same asinnerText, so I can't see the differencetextappears to be the same asinnerTextbut the jQuery shorthand versiontextContentappears to the same asinnerTextbut keeps formatting (such as\n)outerTextappears to be the same asinnerText
My research can only take me so far as I can only test what I can think of or read what is published, can any one confirm though if my research is correct and if there is anything special about label and outerText?