1、Jquery   选择器 id包含特殊字符,加双斜线 \\

<input type="text" id="dbo_HouseInfo.HouseResourceID" />
<script>
var val= $("#dbo_HouseInfo\\.HouseResourceID").val();
</script>

 

2、HTML中的转义字符加单斜线  \

<!----html代码--->
<input type="text" id="children" style="width: 50px;"oninput="value=value.replace(/[^\d]/g,'')"/><!----只允许数据数字的文本框--->

上述<input/>控件要动态添加时:

<script>
 var html = '<input type="text" >注意对比replace 内的代码与在HTML代码的差别
 $("#father").prepend(html);//JQuery写法
 //document.getElementById("father").innerHTML = html;//js写法
</script>

 

 

 

 

 

 

 

 

 

 

 

 

 

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2021-05-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-01-21
相关资源
相似解决方案