How to Access asp.net textbox tooltip via client side JavaScript

J

John Dolinka

I am trying to change a tooltip on an asp.net (framework 2) textbox with out
a post back to the server. I can access many of the textbox properties and
change them but not the tooltip. Below is a code snippet of javascript that
works and the one tooltip "property" that does not.



Any ideas?



var a=document.getElementById("txtValMsg" + res.value.ID);

a.value=res.value.MsgValidator.Value;

a.style.visibility=res.value.MsgValidator.Visable;

a.ForeColor=res.value.MsgValidator.Color;

a.style.width=res.value.MsgValidator.Width;

debugger;

/*

* invalid property here, can't set tool tip.. help

*/

a.ToolTip="hello world";



Thanks,



John Dolinka
 
G

Guest

Well, it's right. The input type text does not have a "ToolTip" property.
What exactly are you trying to do?
 
J

John Dolinka

AJAX enabled web page passes data back to server, server acts on data and
passes it back as an object that updates controls on web page including
textbox (using JavaScript to extract data and update controls). I am able
to update everything I need to on page except the tooltip. If I had access
to tooltip from JavaScript I could do this.



Thank,



John Dolinka
 
N

neilmcguigan

the HTML attribute is called Title

you could try

myControl.Attributes["Title"] = "something";

cheers

neil
 
N

neilmcguigan

in javascript, on the client:

var txt1 = document.getElementById("myId");
txt1.title = "some tooltip";
 
G

Guest

AJAX is doing it's job. I understand that but the Input element of type text
does not have a ToolTip property therefore it will fail. The property to
change is Title not ToolTip.

The rendered HTML markup of a TextBox control is an Input element. To render
the ToolTip property the control assigns the Title property of the Input.
Therefore the Title property should be what AJAX is updating on the client.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top