<!DOCTYPE html>
<input type = "texe" id="uname">
<input type = "button" id="123" onclick="ceshi()" value="登录">
function ceshi(){ var name1=$("#uname").val(); $("#demo")=text.(name1); alert(name1); }$("#demo")=text.(name1); ?这个是什么用法哦。你要比较,要么前端数据取到去后台比较,要么后台数据取到去前端比较。没看懂你这个写什么。
这个代码有几个错误:
1、input的type类型:text;
2、你的代码没有明确的说明要比较的数据是什么,如果你是要在前台作比较,你得先通过ajax获取后台过来的数据,然后再同$("#uname").val()你抓取的这个文本框的值作比较。
要么就是在后台作比较,你把这个$("#uname").val()通过ajax发送到后台的php在后台进行数据比较。