Difference between .html() and .text() functions in jQuery
Difference between .html() and .text() functions in jquery:
.html() can be used to get the contents of inside an element. If your selector expression matches more than one element, only the first match will have its HTML content returned:
here is an example:
- list sample 1
- list sample 2
- list sample 3
now if you are using .html():
$(‘.html-function-demo’).html();
your output is:
- list sample 1
- list sample 2
- list sample 3
now if you are using .text():
$(‘.html-function-demo’).text();
your output is:
list sample 1 list sample 2 list sample 3
due to different properties of HTML Parsers of your browser, the output for your function varies in the manner that the output will be in one line or continuous one or with spaces and linebreaks.
Both functions return strings as their output.
This is a fantastic blog from which people can learn a lot. It is very informative and is explained in…
Thanks for sharing such knowledgeable Content on Automation testing, to know how to enhance the performance of ERP's like Oracle…
Thanks.. this list is much needed.
This one is also good to use. Thanks for sharing this.. Might be we can also add it in list…
How about youtube-dl?