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

  • Thread starter Thread starter John Dolinka
  • Start date Start date
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
 
Well, it's right. The input type text does not have a "ToolTip" property.
What exactly are you trying to do?
 
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
 
the HTML attribute is called Title

you could try

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

cheers

neil
 
in javascript, on the client:

var txt1 = document.getElementById("myId");
txt1.title = "some tooltip";
 
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.
 
Back
Top