我在页面上有一个网格,其中包含一系列动态生成的单选按钮。所有单选按钮都有一个相似的 ID 名称,除了 ID 名称的中间 - 一个增量变量 CTL##(ctl00、ctl01 等)
<input id="ctl00_PageBody_grdCustomer_ctl01_rdoCustomerSelect" type="radio" value="rdoCustomerSelect">
<input id="ctl00_PageBody_grdCustomer_ctl02_rdoCustomerSelect" type="radio" value="rdoCustomerSelect">
<input id="ctl00_PageBody_grdCustomer_ctl03_rdoCustomerSelect" type="radio" value="rdoCustomerSelect">
<input id="ctl00_PageBody_grdCustomer_ctl04_rdoCustomerSelect" type="radio" value="rdoCustomerSelect">
<input id="ctl00_PageBody_grdCustomer_ctl05_rdoCustomerSelect" type="radio" value="rdoCustomerSelect">
如果它以特定模式开始/结束,我已经找到匹配 ID 的代码,但无法弄清楚如何提取匹配模式并将其分配给属性。
我的最终目标是使标签的格式如下...
<input id="ctl00_PageBody_grdCustomer_ctl01_rdoCustomerSelect" type="radio" value="rdoCustomerSelect" title="rdo_ctl01">
<input id="ctl00_PageBody_grdCustomer_ctl02_rdoCustomerSelect" type="radio" value="rdoCustomerSelect" title="rdo_ctl02">
<input id="ctl00_PageBody_grdCustomer_ctl03_rdoCustomerSelect" type="radio" value="rdoCustomerSelect" title="rdo_ctl03">
等等...
有什么建议么?谢谢。