Rails 3: How to display properly text from “textarea”?

Rails got a helper method out of the box, so you dont have to write your own method. From the documentation: simple_format(text, html_options={}, options={}) my_text = “Here is some basic text…\n…with a line break.” simple_format(my_text) # => “<p>Here is some basic text…\n<br />…with a line break.</p>” more_text = “We want to put a paragraph…\n\n…right there.” … Read more

How to make textarea to fill div block?

Please refer to this article which implements the CSS3 box-sizing property http://css-tricks.com/box-sizing/ A quick solution for this is to set textarea { width: 100%; -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; /* Opera/IE 8+ */ } And here is a working example which implements the box-sizing … Read more

WebView textarea doesn’t pop up the keyboard

The full solution is a bit more than what Sana had. It is documented as a bug over at the Android site ( http://code.google.com/p/android/issues/detail?id=7189 ): webView.requestFocus(View.FOCUS_DOWN); webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_UP: if (!v.hasFocus()) { v.requestFocus(); } break; } return false; } });

How to get selected text from a textbox control with JavaScript

OK, here is the code I have: function ShowSelection() { var textComponent = document.getElementById(‘Editor’); var selectedText; if (textComponent.selectionStart !== undefined) { // Standards-compliant version var startPos = textComponent.selectionStart; var endPos = textComponent.selectionEnd; selectedText = textComponent.value.substring(startPos, endPos); } else if (document.selection !== undefined) { // Internet Explorer version textComponent.focus(); var sel = document.selection.createRange(); selectedText = sel.text; … Read more