Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to de-highlight highlighted text? 1

Status
Not open for further replies.

EwS

Programmer
Joined
Dec 30, 2002
Messages
398
Location
US
How do I de-highlight highlighted text?
Thank you!
 
The text is selected (with .select()), rather than highlighted. I tried setting the .backgroundColor, but it didn't work.
 
The following removes the highlight from the field:

document.myForm.myControlName.value = document.myForm.myControlName.value;

but is there any more proper way?

 
EwS,

Did you ever figure out an answer to this? I want to do the same thing.

Thanks.

--Dave
 
Hello LookingForInfo,

This is one way to do this. It looks better and more formal. If the scope is just a textbox, it does not much more than the .value=.value trick.
[tt]
if (document.selection) {
document.selection.empty();
}
[/tt]
regards - tsuji
 
tsuji,

My situation is that I have a table filled with many columns. The left-most column is a checkbox, but I set it up so a user can click on any cell in the row to check/uncheck the associated checkbox.

Per request, I set it up so that holding the shift key down when clicking on the cell will check the associated checkbox AND any checkbox above it. This works, but had the unfortunate side effect of highlighting text on the page. The .value=.value trick couldn't work then...

...but your suggestion DOES!

Thank you!

--Dave
 
Dave,LookingForInfo:

Thanks for the vote and the description of your unique problem to solve. I take note of that use. Much appreciated.

- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top