Search code examples
htmlgoogle-chromemozilla

copy values of html in a browser


How does one copy all the values of the specific elements in the html page?

This image shows what I mean:

enter image description here

I would like to copy all the values of the option element-> cityOne, cityTwo and so forth. option elements are children of the select element.

Is it possible to copy just the values in mozilla or chrome?


Solution

  • enter image description hereit's easy. you just need to know your developer tools and browser console well enough.

    first. in your inspector. click on the select-element, then go to your browser console and type in the following code

    for(var i=0; i<$0.getElementsByTagName("option").length; i++){console.log($0.getElementsByTagName("option")[i].innerText);}
    

    $0 refers to the currently selected element in your inspector window.