0
Follow
2
View

Element selector

kcsj999 注册会员
2023-02-28 10:29

This answer quotes ChatGPT

A Select selector that uses Element to create an entry is de-duplicated by default. If you want it not to be de-duplicated, you can set multiple to multiple="multiple" and then use the same value when creating options to create multiple options. For example:

<select multiple="multiple">
  <option value="apple">Appleoption>
  <option value="banana">Bananaoption>
  <option value="apple">Appleoption>
  <option value="cherry">Cherryoption>
  <option value="banana">Bananaoption>
select>

In this example, the multiple attribute tells the browser that it can select multiple options, and then uses the same value to create multiple options that are not de-duplicated.

dxh8678 注册会员
2023-02-28 10:29
< div class = "md_content_show e397 data - v - 3967" = "" >

no, Is the custom entry data < br / >

< div class = "aw - list - img > img

didiming1981 注册会员
2023-02-28 10:29

You don't have to redo it, just make sure the id is unique

dudula2193 注册会员
2023-02-28 10:29
< div class = "md_content_show e397 data - v - 3967" = "" >

added, No < br / >

< div class = "aw - list - img > img

dongkai0919 注册会员
2023-02-28 10:29

The Select selector in the
Element removes duplicate options by default. If you want to keep duplicate options in the Select selector, you can set the multiple property of the Select selector to true, which allows the user to select multiple duplicate options.

For example, the following code creates a Select selector with repeated options and sets its multiple property to true:


from  lxml import etree

# 创建Select选择器
select = etree.Element("select", multiple="true")

# 添加重复选项
option1 = etree.Element("option", value="1")
option1.text = "选项1"
select.append(option1)

option2 = etree.Element("option", value="2")
option2.text = "选项2"
select.append(option2)

option3 = etree.Element("option", value="3")
option3.text = "选项3"
select.append(option3)

option4 = etree.Element("option", value="2")
option4.text = "选项2"
select.append(option4)

# 输出Select选择器
print(etree.tostring(select, pretty_print=True, encoding="unicode"))

The Select selector created in this way will retain duplicate options.

Hope to help you, hope to adopt

kc50130017 注册会员
2023-02-28 10:29

img


Is that what you mean when you run over there?

wangcuixiang77 注册会员
2023-02-28 10:29

filterable select

About the Author

Question Info

Publish Time
2023-02-28 10:29
Update Time
2023-02-28 10:29