我有个问题.看下面的代码:
$(function () {
$('span').live('click', function () {
var input = $('<input />', {
'type': 'text',
'name': 'aname',
'value': $(this).html()
});
$(this).parent().append(input);
$(this).remove();
input.focus();
});
$('input').live('blur', function () {
$(this).parent().append($('<span />').html($(this).val()));
$(this).remove();
});
});
Run Code Online (Sandbox Code Playgroud)
和HTML现在:
<span>Click aici</span>
Run Code Online (Sandbox Code Playgroud)
所以,这显然适用于jquery 1.8.3,包括在内.在1.8.3 .live()被弃用之后,我们需要使用.on().所以代码变成:
$(function () {
$('span').on('click', function () {
var input = $('<input />', {
'type': 'text',
'name': 'aname',
'value': $(this).html()
});
$(this).parent().append(input);
$(this).remove();
input.focus();
});
$('input').on('blur', function () {
$(this).parent().append($('<span />').html($(this).val()));
$(this).remove();
});
});
Run Code Online (Sandbox Code Playgroud)
要不就:
$(function () {
$('span').click(function () { …Run Code Online (Sandbox Code Playgroud) 我正在使用一个项目,使用Process.start()重定向到实时Web OAuth请求令牌后,在本地IIS服务器上部署该站点它停止工作,它不会在这里进行任何重定向我的代码
authorizeUri.AppendFormat("?client_id={0}&", appId);
authorizeUri.AppendFormat("scope={0}&", "wl.signin");
authorizeUri.AppendFormat("response_type={0}&", "token");
authorizeUri.AppendFormat("redirect_uri={0}", HttpUtility.UrlEncode("http://scarnetdomain.com/Default3.aspx/"));
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = authorizeUri.ToString();
Process.Start(startInfo);
Run Code Online (Sandbox Code Playgroud) 什么是代码明智的开发和网站的faging之间的区别?
我的意思是开发< - >直播,比直播所有代码都干净/最小化,对吧?
任何信息,现实生活中的"代码"部分示例?
我正在开发一个项目,当我按下min/plus按钮而不用方法悬停图片时.live(),该功能正常工作.在.on()方法的情况下,该功能不起作用.
我该如何解决这个问题,所以它也适用于.on()方法?
这是我所指的一个例子(我修复了这个例子中的错误,但我使用的.on方法是错误的).