if (is_key(event, 13) && (with_field.value.length > 1)){ var search_list_ele_array = new Array(); var search_list_ele_array = document.getElementById('with_auto').getElementsByTagName('li'); for (j=0; j<search_list_ele_array.length; j++) { if ((search_list_ele_array[j].className == 'user list_hover') || (search_list_ele_array[j].className == 'comp list_hover') || (search_list_ele_array[j].className == 'blog list_hover')){ var link = search_list_ele_array[j].getElementsByTagName('a'); user_add(link[0], search); } } return false; }
Stop Enters
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Stop Enters
I have a textarea and I need to stop the line breaks from happening when enter is pressed. Why doesn't return false work?
Re: Stop Enters
if you don't want multilines why are you using a text area?
i haven't tried achieving this, but try using substr. textbox value = substr(0,textbox.value - 1)
just a quick thought off the top of my head.
i haven't tried achieving this, but try using substr. textbox value = substr(0,textbox.value - 1)
just a quick thought off the top of my head.
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Stop Enters
Your quick thought might be good in theory but it is not correct. If I wrote "Hi am really cool [enter]", then that would erase everything I just wrote which is not what I want to do. I want to disable enters, NOT trim them. P.s. I just need a text area... too long to describe.Torniquet wrote:if you don't want multilines why are you using a text area?
i haven't tried achieving this, but try using substr. textbox value = substr(0,textbox.value - 1)
just a quick thought off the top of my head.
Re: Stop Enters
I think you would have use that method, the code should have been
textbox.value = textbox.value.substr(0, textbox.value.length - 1);
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Stop Enters
Hmm that actually still didn't work for me.jacek wrote:I think you would have use that method, the code should have been
textbox.value = textbox.value.substr(0, textbox.value.length - 1);
I need to you use...
with_field.onkeypress = function(event){ if (is_key(event, 13) === true){ return false; } }
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Stop Enters
Whoops I meant that the thread above was what I needed to use. It works now.jacek wrote:so what error are you getting now ?