要匹配的标签如下:
<input name="rptQuestions:_ctl0:txtQuestionType" type="text" value="1" id="rptQuestions__ctl0_txtQuestionType" style="width:0px;" />
<input name="rptQuestions:_ctl0:txtQuestionTypes" type="text" value="56" id="rptQuestions__ctl0_txtQuestionTypes" style="width:0px;" />匹配整个标签,我要把字符合条件的标签删除。
其中主要以name和id中的txtQuestionType 做主要标识改怎么样写正则表达式才可以删除name和ID中存在txtQuestionType 的整个标签
<input name="rptQuestions:_ctl0:txtQuestionType" type="text" value="1" id="rptQuestions__ctl0_txtQuestionType" style="width:0px;" />
<input name="rptQuestions:_ctl0:txtQuestionTypes" type="text" value="56" id="rptQuestions__ctl0_txtQuestionTypes" style="width:0px;" />匹配整个标签,我要把字符合条件的标签删除。
其中主要以name和id中的txtQuestionType 做主要标识改怎么样写正则表达式才可以删除name和ID中存在txtQuestionType 的整个标签
var p=/<input\s*name=".*?(?:txtQuestionType)"[^>]*>/gi;
alert(s.replace(p,''));
$("input[name^='rptQuestions'][id=^='rptQuestions']").remove();
“^=”配置以属性以给定字符串开头的元素
删除name或id包含txtQuestionType的input元素