How to disable the feature to select a text

S

Stefan Mueller

I've a HTML table with several columns. If you click on the header of
a column the appropriate column gets sorted.
If you move the mouse while clicking the header or you even double
click the header the text in the header gets selected.

Is there any possibility to disable this feature so that the text in
the header never gets selected?
 
A

Andy

Stefan Mueller said:
I've a HTML table with several columns. If you click on the header of
a column the appropriate column gets sorted.
If you move the mouse while clicking the header or you even double
click the header the text in the header gets selected.

Is there any possibility to disable this feature so that the text in
the header never gets selected?

You could place an absolute positioned div within a relative positioned div
(which contains your heading) then use a 100% height by 100% width blank
image in the absolute div as your link (onclick) anchor.

This would also have the advantage of making the entire heading container
clickable and not just the text.

If you need me to mock up a working example, let me know.


Andy
 
R

rf

Stefan Mueller said:
I've a HTML table with several columns. If you click on the header of
a column the appropriate column gets sorted.
If you move the mouse while clicking the header or you even double
click the header the text in the header gets selected.

Yes. That is how browsers work.
Is there any possibility to disable this feature so that the text in
the header never gets selected?

No.

Well, acutally, not with HTML but there is a way with heaps of javascript
but why does this actually give you a problem?
 
S

Stefan Mueller

You could place an absolute positioned div within a relative positioned div
(which contains your heading) then use a 100% height by 100% width blank
image in the absolute div as your link (onclick) anchor.

This would also have the advantage of making the entire heading container
clickable and not just the text.

If you need me to mock up a working example, let me know.

Sounds great.
I'd appreciate it very much if you could post a working example.
 
J

Jukka K. Korpela

rf said:
Yes. That is how browsers work.

Really? Are you sure you are referring to web browsers and not some
spreadsheet programs?

When I mouse over or click on a column header, nothing happens, unless
there's a link there, or something. If I double click on it, a word gets
selected - nothing more. If I triple click, the entire header gets selected.
Still no sorting - and I really don't expect any sorting, as how could a
stupid wowser know that the user wants to sort? How could it figure out the
sorting order?

Huh? How do you _enable_ it in the first place?
 
J

Jukka K. Korpela

Sherm said:
Get a grip. Rf is obviously referring to the selection behavior, not
to the sorting behavior.

There's nothing obvious in it. "Rf" quoted text that discussed both things,
so it is fair to expect that he commented on both of them, not just one part
of the second thing - especially since "rf" did not in any way indicate
otherwise. In adequate quoting, you quote only the part that is necessary
for indicating what is commented on.

Besides, in normal browsers, double clicking selects a word - it takes a
triple click to select a larger part of text. For a single-word header,
there is no difference, but the discussion was at a general level, and at
the general level, the common browser behavior is that the clicked _word_
gets selected.
 
D

dorayme

"Jukka K. Korpela said:
Really? Are you sure you are referring to web browsers and not some
spreadsheet programs?

The OP gave no url and it is hard to know what he was referring to,
perhaps he is somehow involved in a page with scripting? Certainly no
web browser simply sorts anything. The only other column/row sorting way
is to make things in the TH links to other html pages where the items
are differently (statically) arranged (I did this static once so people
could look at Australian towns by postcode or by alphabetical order)

When I mouse over or click on a column header, nothing happens, unless
there's a link there, or something. If I double click on it, a word gets
selected - nothing more. If I triple click, the entire header gets selected.
Still no sorting - and I really don't expect any sorting, as how could a
stupid wowser know that the user wants to sort? How could it figure out the
sorting order?


Huh? How do you _enable_ it in the first place?

Good question and exactly what I was thinking too. OP is not telling us
something!
 
D

dorayme

....
It's patently obvious to anyone who doesn't have a preconceived notion
that everyone else in the world is a drooling moron, and a pathological
need to "prove" it.
Like I said - get a grip.


Sherm! This is really way out of line, you are being so horrid and
unfair! JK has done nothing at all in this thread to deserve this.
 
R

rf

dorayme said:
...



Sherm! This is really way out of line, you are being so horrid and
unfair! JK has done nothing at all in this thread to deserve this.

Get a grip dorayme. JK is a fucking pedantic idiot and this thread simply
proves it.
 
R

rf

dorayme said:
Huh? How do you _enable_ it in the first place?

Good question and exactly what I was thinking too. OP is not telling us
something![/QUOTE]

Move mouse to somewhere over some text. Press mouse button. Move mouse.
Release mouse button. Admire selected text. Pretty bloody obvious to me.
 
D

dorayme

"rf said:
Get a grip dorayme. JK is a fucking pedantic idiot and this thread simply
proves it.

He is not being any more pedantic than any reasonable poster might be
nor idiotic, and this thread proves no such thing.

Formerly, you did nothing wrong, it was a simple matter of you probably
saying something true (as you often do) but it was unclear enough to
justify what was a perfectly polite and ordinary querying response from
JK.

Sherm was extraordinary in his vituperation and you are now surprising
me no end! Don't you scripting guys ever forgive and forget? You are
both misreading him on this occasion and being unfair. If you have
gripes from the past, keep them as ammo and dry for where they might be
more appropriate.

A grip? I know a dirty variation on an advertizing jingle for an
Australian glue called Tarzan's Grip, it used to go:

"Get a tube of Tarzan's Grip"
 
D

dorayme

"rf said:
Move mouse to somewhere over some text. Press mouse button. Move mouse.
Release mouse button. Admire selected text. Pretty bloody obvious to me.

Not in the original context and mixed up with changes of order... It is
amazing how things appear to you if you know what you mean and also in
hindsight to others...

As it happens, clicking and moving mouse does *not* guarantee the text
gets selected, you have to do a certain amount of moving. Just think
about it in detail: The OP talks about moving the mouse possibly in the
context of column sorting so maybe someone reading this is simply not
thinking "ah text selection!" Text selection requires a bit more than
just moving the mouse a bit. What has text selection got to do with
anything? Why is selection needing to be disabled?
 
R

rf

dorayme said:
He is not being any more pedantic than any reasonable poster might be
nor idiotic, and this thread proves no such thing.

Formerly, you did nothing wrong, it was a simple matter of you probably
saying something true (as you often do) but it was unclear enough to
justify what was a perfectly polite and ordinary querying response from
JK.

Bullshit. Nothing is unclear. The subject of this thread is "How to diable
the feature to select a text". How bloody unclear is that? The OP doesn't
want text selected. Now, read the OPs further words:

"the text in the header gets selected" and "is there any possiblility do
disable this feature so the text [in the header] never gets selected".
Selected. How does text get selected? By clicking and moving the mouse, just
like it gets selected in just about every bloody program out there. The OP
doesn't want that. That was what I was commenting on, not the bloody price
of tea.

So, we are clearly talking about selecting text here. I have no fucking idea
what Korpella was talking about, except that in his usual pedantic way he
comes over as a complete arsehole.
 
R

rf

So, we are clearly talking about selecting text here. I have no fucking
idea what Korpella was talking about, except that in his usual pedantic
way he comes over as a complete arsehole.

And here are you defending him.
 
R

rf

dorayme said:
Not in the original context and mixed up with changes of order... It is
amazing how things appear to you if you know what you mean and also in
hindsight to others...

As it happens, clicking and moving mouse does *not* guarantee the text
gets selected, you have to do a certain amount of moving. Just think
about it in detail: The OP talks about moving the mouse possibly in the
context of column sorting so maybe someone reading this is simply not
thinking "ah text selection!" Text selection requires a bit more than
just moving the mouse a bit. What has text selection got to do with
anything? Why is selection needing to be disabled?

Does the word "select" have any meaning to you? The OP is complaining about
text being "selected". How the bloody hell can text be selected if one has
not moved the mouse far enough to select text? And if the OP has not moved
the mouse far enough to have selected text then why would he be complaining
about text being selected?

Arguing for the sake of arguing I think. You are becoming as big a bloody
pedant as Korpela is.
 
D

dorayme

"rf said:
Bullshit. Nothing is unclear. The subject of this thread is "How to diable
the feature to select a text".

It is an odd thing to announce this as *a feature*, it is so second
nature. If someone asks, how do you turn the sun off, you don't simply
go on to answer (unless, maybe, you are Superman). It just seems
surprising! Bundled with column sorting (the other thing mentioned
practically in the first breath of the OP's post), I say it can create a
haze in which normally intelligent beings can get a bit disorientated.
....
I have no fucking idea
what Korpella was talking about, except that in his usual pedantic way he
comes over as a complete arsehole.

He did not, you must be thinking of other threads and it is influencing
you. A bit of pedantry is not so bad and it needs to be contrasted with
its opposite - please God, let someone ask me what the opposite of
pedantry is - to get a better appreciation of it. I think pedantry has
had an altogether unfair press for a long time. Pedantry does not make
for arseholiness all by itself. Be fair, Richard!
 
A

Adrienne Boswell

Gazing into my crystal ball I observed Stefan Mueller
I've a HTML table with several columns. If you click on the header of
a column the appropriate column gets sorted.
If you move the mouse while clicking the header or you even double
click the header the text in the header gets selected.

Is there any possibility to disable this feature so that the text in
the header never gets selected?

You really did not give us enough to go on, certainly a URL would have
helped, and here you got some of the best regulars around here not being
very nice to each other.

So, I'm going to put on my crystal ball hat and guess at what you are
trying to do/not do.

1. You cannot sort an HTML table without some kind of client side or
server side scripting invovled. Simply clicking on text will indeed
select it - that is the way it's supposed to be.

2. There is probably a href somewhere that uses a querystring to tell
either the server side script or a client side script to sort the data
when that link is clicked. Perhaps something like
http://example.com/table.php?sort=1

If it is clearly a link, then users will click on it. If it is not
clear, and they are clicking somewhere else, you might have that select
text behaivor.

Really, without a URL it is impossible for me to go any further.
 
D

dorayme

"rf said:
....

Does the word "select" have any meaning to you? ...

I was thinking of your words not the OP's at this point. I followed your
instructions and nothing happened. I trusted you!
Arguing for the sake of arguing I think.

er... maybe a little with you yes... <g>

But I was really pissed off when I saw Sherm be so incredibly reactive
(to put it politely). I have nothing against Sherm, he uses Macs, his
seemed like such an unnecessarily angry response.

Plus, I don't like to see someone who has contributed so magnificently
to the world of HTML and CSS be hounded when he is *not* doing anything
to deserve it. This is 21st Century, not the 13th. Why don't you and
Sherm grab Jerry Stuckle and have some fun with him, he always deserves
the stocks and rotting tomatoes thrown at him...

Around Xmas maybe a little more anger management, lads!
You are becoming as big a bloody
pedant as Korpela is.

That is a horrible thing to say! He is not even in my league in this
pedantry business, he is too serious for that and every year I get the
silver cup... <g>
 
D

dorayme

Sherm Pendley said:
I wouldn't say he's an idiot. Quite the opposite in fact - I think he's
smarter than most of the people here, including me. He is, however,
very badly lacking in people skills.

You should talk, Mr Diplomacy Who Began All This! <g>
 
S

Stefan Mueller

Sorry for my unclear and confusing posting.
Yes, of course, a normal HTML table is not sortable by clicking on its
header row and in that case I wouldn't care about the "selection
feature".
I'm using javascript to make the HTML table sortable. Therefore you
can click on the header row to sort the columns.

The practice shows that if you click on the header row to sort the
columns to often a letter or even the whole text in the header row of
the columns gets selected.
Now I'm trying to find a way to disable this "selection feature".

I think that Andy's suggestion could be the solution for my problem:
You could place an absolute positioned div within a relative
positioned div (which contains your heading) then use a 100% height by
100% width blank image in the absolute div as your link (onclick)
anchor.

But it's not working so far. Any additional help is very welcome.
Stefan
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top