为了账号安全,请及时绑定邮箱和手机立即绑定

html标签ID中的特殊字符

html标签ID中的特殊字符

白板的微信 2019-12-06 11:12:07
在html代码中,我正在使用代码 <input type = "text" id = "abc@def.com">获取文本,现在它需要获取在文本字段中输入的值。我正在使用jQuery来做到这一点:$( document ).ready( function() {    $( ".bid" ).click( function() {        idVal = this.id        bidID = "#" + idVal + "bid"        spanID = "#" + idVal + "cbid"        bidValue = $(bidID).val();        alert(idVal)        alert(bidID)        alert(bidValue) //this alert says undefined        $( spanID ).html( '&nbsp;' ).load( '{% url online_machines %}?id=' + idVal + '&bidvalue=' + bidValue);    });});通过这样做我得到未定义的值错误。我试图从ID中删除特殊字符以获取其值。但是我需要带特殊字符的ID。如何使用jquery获得其值?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 968 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信