在html代碼中,我正在使用代碼 <input type = "text" id = "abc@def.com">獲取文本,現(xiàn)在它需要獲取在文本字段中輸入的值。我正在使用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( ' ' ).load( '{% url online_machines %}?id=' + idVal + '&bidvalue=' + bidValue); });});通過這樣做我得到未定義的值錯誤。我試圖從ID中刪除特殊字符以獲取其值。但是我需要帶特殊字符的ID。如何使用jquery獲得其值?
添加回答
舉報
0/150
提交
取消