如何获取文本框的标题/工具提示... [英] How can I get the title/tooltip of a textbox...

查看:112
本文介绍了如何获取文本框的标题/工具提示...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做一些非常简单但无法使其发挥作用的事情。



我需要获取工具提示的值并将其与当前文本框中的文本进行比较。我想在javascript中执行此操作,以便在将其发送到服务器之前发布客户端弹出确认。我似乎无法得到文本框。我已经尝试过使用jquery并且标题和innertext属性是空白的,即使我点击f12时,标题和值都在那里。



 function confirmHiredChange(ctrl){
debugger;
var row = $( tr [ ID = TRID]);
var tbHiredDtm = row.find( 输入[ID $ = tbeRecruitHiredDtm]);
if (tbHiredDtm [ 0 ]。title!=
return ;
else if (tbHiredDtm [ 0 ]。 value ==
return true ;
返回确认(' 你确定你想要更新__?');
}





执行onclientclick并返回确认。我只想显示先前未设置工具提示(string.empty)和文本值是否设置(!string.empty)。它找到了文本框,但无论我做什么,当我来到tbHiredDtm [0]时,两个属性都定义为,即使我点击f12它显示它们。



我知道这是我做错的小事,所以如果你看到我可以随意告诉我。或者,如果你知道一个更好的方式让我知道。



编辑:TLDR-基本上我怎样才能在javascript中获得asp的工具提示值:textbox?

解决方案

tr [id = TRID]);
var tbHiredDtm = row.find( 输入[ID

= tbeRecruitHiredDtm]);
if (tbHiredDtm [ 0 ]。title!=
return ;
else if (tbHiredDtm [ 0 ]。 value ==
return true ;
返回确认(' 你确定你想要更新__?');
}





执行onclientclick并返回确认。我只想显示先前未设置工具提示(string.empty)和文本值是否设置(!string.empty)。它找到了文本框,但无论我做什么,当我来到tbHiredDtm [0]时,两个属性都定义为,即使我点击f12它显示它们。



我知道这是我做错的小事,所以如果你看到我可以随意告诉我。或者,如果你知道一个更好的方式让我知道。



编辑:TLDR-基本上我怎样才能在javascript中获得asp的工具提示值:textbox?


在你的例子中(假设tbHiredDtm是你想要的标题):



  var  title = 


I''m trying to do something extremely simple yet can not get it to work.

I need to get the value of a tooltip and compare it to the text that is currently in a textbox. I want to do it in javascript so that I can post a client-side pop up confirm before I send it to the server. I can''t seem get the textbox. I''ve tried using jquery and the title and innertext properties are blank even though when I hit f12, the title and value are there.

function confirmHiredChange(ctrl) {
        debugger;
        var row = $("tr[id=trid]");
        var tbHiredDtm = row.find("input[id$=tbeRecruitHiredDtm]");
        if (tbHiredDtm[0].title != "")
            return true;
        else if (tbHiredDtm[0].value == "")
            return true;
        return confirm('Are you sure you want to update this __?');
    }



this executes onclientclick and returns the confirm. I only want to show if the tooltip was previously not set (string.empty) and text value is set (! string.empty). It finds the textbox but no matter what I do, both properties are defined as "" when I come to tbHiredDtm[0] even though when I hit f12 it shows them.

I know it is something small that I am doing wrong, so if you see it feel free to let me know. Or if you know of a better way let me know that as well.

EDIT: TLDR- Basically how can I, in javascript, get the tooltip value of an asp:textbox ?

解决方案

("tr[id=trid]"); var tbHiredDtm = row.find("input[id


=tbeRecruitHiredDtm]"); if (tbHiredDtm[0].title != "") return true; else if (tbHiredDtm[0].value == "") return true; return confirm('Are you sure you want to update this __?'); }



this executes onclientclick and returns the confirm. I only want to show if the tooltip was previously not set (string.empty) and text value is set (! string.empty). It finds the textbox but no matter what I do, both properties are defined as "" when I come to tbHiredDtm[0] even though when I hit f12 it shows them.

I know it is something small that I am doing wrong, so if you see it feel free to let me know. Or if you know of a better way let me know that as well.

EDIT: TLDR- Basically how can I, in javascript, get the tooltip value of an asp:textbox ?


In your example (assuming tbHiredDtm is the what you want the title of) :

var title =


这篇关于如何获取文本框的标题/工具提示...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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