if there's a html like this:
<select name="" id="selectxzq">
<option value="">-chose-one-</option>
<option value="44">A-chose</option>
<option value="14">B-chose</option>
<option value="39">C-chose</option>
<option value="4">D-chose</option>
</select>
when i write code like this:
...
body, err := ioutil.ReadAll(resp.Body)
rspHtml := mahonia.NewDecoder("UTF-8").ConvertString(string(body))
doc, err := goquery.NewDocumentFromReader(strings.NewReader(rspHtml))
if err != nil {
log.Fatalln(err)
}
// Find the review items
doc.Find("#selectxzq").Each(func(i int, s *goquery.Selection) {
optionT := s.Find("option").Text()
fmt.Printf("Review %d: %s \n", i, optionT)
})
I also can get the text() of the options,like this:
Review 0: -chose-one-A-choseB-choseC-choseD-chose
but I don't konw how to get the value of the option by use the goquery,the .Attr() methods also can not use to get the value