0

Textbox cursor position

asked 2010-12-15 19:18:52 +0800

yaudeh gravatar image yaudeh
6

how to get the cursor position from a Textbox.
I can only find setSelectionRange but can not find getSelectionRange.
How to get the cursor position from a Textbox.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-12-16 09:27:26 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

updated 2010-12-16 09:27:36 +0800

Hi yaudeh,
You can listen the onChanging event, then you will retrieve a InputEvent.
please refer to the following link
InputEvent

link publish delete flag offensive edit

answered 2010-12-21 21:34:57 +0800

yaudeh gravatar image yaudeh
6

the onChanging event will not be triggered when the mouse click the textbox to change the cursor position.

link publish delete flag offensive edit

answered 2011-05-02 06:42:16 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

I have created a sample

<zk>
	<textbox id="tb" onMyClick='msg.value = event.getData()+"";' />
	<label id="msg"/>
	<zscript><![CDATA[
		tb.setWidgetListener("onClick", 
				"zAu.send(new zk.Event(this,\"onMyClick\", zk(this.$n()).getSelectionRange()[1]));");
	]]></zscript>
</zk>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-12-15 19:18:52 +0800

Seen: 898 times

Last updated: May 02 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More