如何使用JQUERY在TEXTBOX中设置焦点 [英] How To set Focus in TEXTBOX using JQUERY

查看:61
本文介绍了如何使用JQUERY在TEXTBOX中设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



任何人都可以建议我使用Jquery将重点放在Texbox上,我使用编码

 $(  input [id $ ='txtDate'])。模糊(function()
{
if (!checkDate($( < span class =code-string> txtDate)。val()))
{
alert( 无效日期);
$( #txtDate )。val( );
$(' #txtDate')。focus();
}
});



这是编码,但是在这里,值Textbox没有清除它的值而且它没有设置Focusing in that文本框txtDate。

解决方案

输入[ id


='txtDate'])。blur(function()
{
if (!checkDate(


txtDate ).val()))
{
alert( 无效日期 );

Hi Friends ,

Can any one suggest me, to set focus on Texbox using Jquery , Im using the Coding

$("input[id$='txtDate']").blur(function ()
      {
          if(!checkDate($("txtDate").val()))
          {
            alert("Invalid Date");
            $("#txtDate").val("");
            $('#txtDate').focus();
           }
      });


This is the Coding but in this , the value Textbox is not clearing its value And also its not set Focusing in that Textbox "txtDate" .

解决方案

("input[id


='txtDate']").blur(function () { if(!checkDate(


("txtDate").val())) { alert("Invalid Date");


这篇关于如何使用JQUERY在TEXTBOX中设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆