Textarea tricks
Содержание:
- Атрибуты тега textarea
- Получение значения из поля textarea -> javascript
- HTML Read Only Text Areas:
- HTML — Text Areas: Disabled
- HTML Code:
- Disabled Textareas:
- HTML Справочник
- HTML Теги
- readonly CSS Style#
- Code Example
- What is Used For?
- HTML5 Textarea Attributes
- Attributes in Action
- HTML Text Area No Word Wrap:
- HTML — Text Areas: Readonly
- HTML Readonly Attribute:
- HTML Read Only Text Areas:
- HTML — Text Areas: Disabled
- HTML Code:
- Disabled Textareas:
- HTML Теги
- HTML Ссылки
- HTML Теги
- Attributes of HTML5 Textarea Attributes: Here’s What You Should Know
- Код
- HTML Теги
- Create CSS Variables for Theming#
- JavaScript
- Пример использования
- JavaScript
- Reset Styles#
- JavaScript
- Textarea Object Properties
Атрибуты тега textarea
| Атрибут | Значения | Описание |
|---|---|---|
| autofocus | не указывается / autofocus |
Логический атрибут. Если указан, при загрузке документа фокус будет переведен на текстовую область. |
| cols | число |
Определяет ширину текстовой области. Ширина области рассчитывается в пикселях как ширина символа, умноженная на значение этого атрибута. Значение приблизительно равняется количеству символов моноширинного шрифта, которые должны занимать полную строку в текстовой области. |
| disabled | не указывается / disabled |
Логический атрибут. Если указан, делает текстовую область неактивной. Данные текстовой области, отмеченной этим атрибутом, не будут переданы на сервер при отправке формы. Также отключает возможность ввода текста в текстовую область. |
| form | id формы |
Указывает на форму, к которой относится текстовая область. Используется, если <textarea> находится вне HTML кода формы. Если текстовая область находится внутри тега <form>, то использовать атрибут form не нужно, текстовая область по умолчанию привязана к форме, внутри которой находится. |
| maxlength | число |
Определяет максимальное количество символов, которые пользователь может ввести в текстовую область. По умолчанию объем текста в текстовой области не ограничен. |
| name | текст |
Имя текстовой области. Используется при передаче данных формы на сервер. Значение (текст) текстовой области будет передано в переменной, имеющей имя, указанное в этом атрибуте. |
| placeholder | текст |
Текст, который будет отображаться внутри текстовой области, когда она не заполнена текстом. Обычно это описание того, что должен ввести пользователь, либо пример заполнения. |
| readonly | не указывается / readonly |
Логический атрибут. Если указан, пользователь не сможет изменить значение (текст) в текстовой области. Используется для создания текстовых областей, доступных только для чтения. |
| required | не указывается / required |
Логический атрибут. Если указан, текстовая область будет определена как обязательная для заполнения. Форма не будет отправлена на сервер, если текстовая область не будет заполнена. Заполнение контролируется браузером. При попытке отправить форму с незаполненной обязательной текстовой областью, браузеры обычно выводят на экран ошибку заполнения. |
| rows | число |
Определяет высоту текстовой области. В качестве значения необходимо указать количество строк, которые должны быть видны без прокрутки (скроллинга). |
| wrap | hardsoft |
Определяет правила переноса строк: Значение hard: символы переноса строки будут добавлены в конце каждой строки в текстовой области. Таким образом, введенный текст из текстовой области переданный на сервер будет иметь ширину не больше, чем ширина <textarea>. Для использования этого значения необходимо указать атрибут cols. Значение soft: символы переноса ставятся там, где их ставил пользователь. Таким образом текст из текстовой области, переданный на сервер в дальнейшем сможет растягиваться под ширину тега-контейнера. Значение по умолчанию. |
Получение значения из поля textarea -> javascript
Для получения из формы textarea значения в javascript, ничего кроме самой формы textarea нам не нужно! И вообще! В javascript нам потребуется лишь уникальная метка, с помощью которой мы сможем обратиться к тегу, как мне кажется самый простой это работать с id, поэтому во внутрь помещаем како-то уникальный id :
<textarea id=»id_textarea»></textarea>
Данные которые попадают в поле textarea, находятся в value
Далее данные из textarea получают таким образом:
var название_переменной = id_textarea.value;
Но поскольку, вы так, ничего не увидите и не поймете, а вообще- попадает, что-то из textarea, нам потребуется написать пару строк, которые вам покажут в процессе набора, что у нас попадает в textarea
Далее, чтобы вы смогли увидеть значение value из textarea, создадим отдельный блок, в который и будет отправлять это значение!
<div id=»therezult»></div>
Далее нам потребуется скриптик javascript , который и выведет значение value на экран:
<script> id_textarea.addEventListener(«keyup», event => { therezult.innerHTML = id_textarea.value; });</script>
Если вам интересно, то соберем весь код вместе:
<div id=»therezult»></div>
<textarea class=»width_99 height_100″ name=»id_textarea» id=»textarea»></textarea>
<script> id_textarea.addEventListener(«keyup», event => { therezult.innerHTML = id_textarea.value; });</script>
Результат — получение данных из textarea в реальном времени и выводе этого значения на экран! Чтобы увидеть данный процесс — начните вводить данные в textarea
Сюда, будем отправлять! post в javascriptphp ajax jQuery
Последняя дата редактирования : 09.03.2021 12:26
//dwweb.ru/comments_1_5/include/img/hand_no_foto.png
no
no
HTML Read Only Text Areas:
As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.
This read-only behavior allows a web surfer to see and highlight the text inside the element, but he or she cannot alter it in any way. When highlighted, the user may also Copy (Ctrl + C on a PC, Ctrl-Click on a Mac) the text to local clipboard and paste it anywhere he/she pleases.
HTML — Text Areas: Disabled
Disabling the textarea altogether prevents the surfer from highlighting, copying, or modifying the field in any way. To accomplish this, set the disabled property to «yes».
HTML Code:
<textarea cols="20" rows="5" wrap="hard" > As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.</textarea>
Disabled Textareas:
As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.
Keep in mind that just because users are unable to copy from the screen directly doesn’t prevent them from taking a screen capture or extracting the data from the source code. Disabling the textarea offers no security whatsoever.
- Continue
HTML Справочник
HTML Теги по алфавитуHTML Теги по категорииHTML ПоддержкаHTML АтрибутыHTML ГлобальныеHTML СобытияHTML Названия цветаHTML ХолстHTML Аудио/ВидеоHTML ДекларацииHTML Набор кодировокHTML URL кодHTML Коды языкаHTML Коды странHTTP СообщенияHTTP методыКовертер PX в EMКлавишные комбинации
HTML Теги
<!—…—>
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<article>
<aside>
<audio>
<b>
<base>
<basefont>
<bdi>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<data>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font>
<footer>
<form>
<frame>
<frameset>
<h1> — <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<picture>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<svg>
<table>
<tbody>
<td>
<template>
<textarea>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
readonly CSS Style#
While not in use often, the attribute prevents additional user input, although the value can be selected, and it is still discoverable by assistive tech.
Let’s add some styles to enable more of a hint that this field is essentially a placeholder for a previously entered value.
To do this, we’ll target any that also has the attriute. Attribute selectors are a very handy method with wide application, and definitely worth adding to (or updating your awareness of) in your CSS toolbox.
In addition to swapping for a border, we’ve also assigned it the cursor and enforced a medium-grey text color.
As seen in the following gif, the user cannot interact with the field except to highlight/copy the value.
Code Example
What is Used For?
HTML5 Textarea Attributes
HTML5 introduced a few new attributes which can be used with textarea elements. Here are some of the most important:
- : Associates the textarea with a form. Use the ID attribute of the form as the value for the textarea form attributes. This allows you to place a textarea anywhere on a webpage, even outside of the form element, and still have the contents of the textarea included when the form is submitted.
- and : Used to specify a minimum or maximum number of characters that may be entered into a textarea.
- : Adds placeholder text to the textarea that disappears as soon as a user places the cursor inside of the element.
- : Requires that the textarea contain content prior to allowing form submission.
- : Specifies whether or not hard-returns should be added to the content submitted in a textarea.
Attributes in Action
Here’s an example of how some of these new attributes can be used to control the behavior of a textarea.
If we pair those textarea elements with a simple script and button element, we get the following form:
Adam Wood
HTML Text Area No Word Wrap:
As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.
HTML — Text Areas: Readonly
Setting a «yes» or «no» value for the readonly attribute determines whether or not a viewer has permission to manipulate the text inside the text field.
HTML Readonly Attribute:
<textarea cols="20" rows="5" wrap="hard" > As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read. </textarea>
HTML Read Only Text Areas:
As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.
This read-only behavior allows a web surfer to see and highlight the text inside the element, but he or she cannot alter it in any way. When highlighted, the user may also Copy (Ctrl + C on a PC, Ctrl-Click on a Mac) the text to local clipboard and paste it anywhere he/she pleases.
HTML — Text Areas: Disabled
Disabling the textarea altogether prevents the surfer from highlighting, copying, or modifying the field in any way. To accomplish this, set the disabled property to «yes».
HTML Code:
<textarea cols="20" rows="5" wrap="hard" > As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.</textarea>
Disabled Textareas:
As you can see many times word wrapping is often the desired look for your text areas. Since it makes everything nice and easy to read.
Keep in mind that just because users are unable to copy from the screen directly doesn’t prevent them from taking a screen capture or extracting the data from the source code. Disabling the textarea offers no security whatsoever.
- Continue
HTML Теги
<!—><!DOCTYPE><a><abbr><acronym><address><applet><area><article><aside><audio><b><base><basefont><bdi><bdo><big><blockquote><body><br><button><canvas><caption><center><cite><code><col><colgroup><data><datalist><dd><del><details><dfn><dialog><dir><div><dl><dt><em><embed><fieldset><figcaption><figure><font><footer><form><frame><frameset><h1> — <h6><head><header><hr><html><i><iframe><img><input><ins><kbd><label><legend><li><link><main><map><mark><menu><menuitem><meta><meter><nav><noframes><noscript><object><ol><optgroup><option><output><p><param><picture><pre><progress><q><rp><rt><ruby><s><samp><script><section><select><small><source><span><strike><strong><style><sub><summary><sup><svg><table><tbody><td><template><textarea><tfoot><th><thead><time><title><tr><track><tt><u><ul><var><video>
HTML Ссылки
HTML по АлфавитуHTML по КатегориямHTML Атрибуты ТеговHTML Атрибуты ГлобалHTML Атрибуты СобытийHTML ЦветаHTML ХолстыHTML Аудио / ВидеоHTML Наборы символовHTML DOCTYPEsHTML Кодирование URLHTML Языковые кодыHTML Коды странHTTP Ответы сервераHTTP МетодыPX в EM конвертерГорячие клавиши
HTML Теги
<!—>
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<article>
<aside>
<audio>
<b>
<base>
<basefont>
<bdi>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<data>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font>
<footer>
<form>
<frame>
<frameset>
<h1> — <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<picture>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<svg>
<table>
<tbody>
<td>
<template>
<textarea>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
Attributes of HTML5 Textarea Attributes: Here’s What You Should Know
| Attribute name | Values | Notes |
|---|---|---|
| <textarea name=»»> | Adds a name attribute to a <textarea> element and associates the name with the text added to the text area. | |
| <textarea wrap=»»> | Determines whether or not submitted text wraps when a <textarea> is included in a form submission. | |
| <textarea cols=»»> | Specifies the visible width of a <textarea> element in average character widths. Defaults to 20 if not specified. | |
| <textarea disabled> | Disables the entry of text into a <textarea> element. | |
| <textarea tabindex=»»»> | Sets the position of a <textarea> element in the tab order. | |
| Textarea Onchange: Get The HTML Code To Trigger A JavaScript Event Now | Adds an event listener to a <textarea> which executes JavaScript scripting when an onchange event occurs. | |
| <textarea onKeyPress=»»> | Adds an event listener to a <textarea> element which executes JavaScript scripting when an onKeyPress event occurs. |
Код
Ключевым моментом данного решения является код CSS. Как уже упоминалось, невидимый клон должен иметь такие же типографические свойства, как и элемент . В список включается не только и , но и свойства и , так как клон должен имитировать все, что происходит внутри элемента
Для элемента код CSS будет следующим:
textarea {
width: 500px;
min-height: 50px;
font-family: Arial, sans-serif;
font-size: 13px;
color: #444;
padding: 5px;
}
.noscroll {
overflow: hidden;
}
Обратите внимание на отдельный класс со свойством , который используется для предотвращения появления полоски прокрутки. Обычно, отключение полоски прокрутки у элемента является плохой идеей, но мы изменяем его с помощью JavaScript
Данный класс будет добавляться кодом JavaScript, поэтому при отключенном JavaScipt элемент будет функционировать нормально (с прокруткой).
Следующий код CSS используется для скрытого клонирующего элемента:
.hiddendiv {
display: none;
white-space: pre-wrap;
width: 500px;
min-height: 50px;
font-family: Arial, sans-serif;
font-size: 13px;
padding: 5px;
word-wrap: break-word;
}
Мы используем свойство , чтобы сделать элемент невидимым для пользователя. Скорее всего, такое решение подходит и для программ читалок с экрана.
Также используется свойство со значением “pre-wrap”, для корректного переноса строк. Ширина элемента клона равна ширине элемента . Кроме того одинаковыми задаются несколько других свойств, в том числе и
А теперь код JavaScript (используется jQuery):
$(function() {
var txt = $('#comments'),
hiddenDiv = $(document.createElement('div')),
content = null;
txt.addClass('noscroll');
hiddenDiv.addClass('hiddendiv');
$('body').append(hiddenDiv);
txt.bind('keyup', function() {
content = txt.val();
content = content.replace(/\n/g, '<br>');
hiddenDiv.html(content);
txt.css('height', hiddenDiv.height());
});
});
Данный код предполагает, что у нас используется только один элемент на странице. Если имеется несколько элементов на странице, то нужно изменить селектор в первой строке для выбора нужных.
Высота динамически изменяется при обработке события jQuery . Код легко изменить для работы с AJAX, если содержание меняется таким образом.
Использование события также является хорошим примером, потому что данный элемент часто используется при ввода данных пользователем.
HTML Теги
<!—…—><!DOCTYPE><a><abbr><acronym><address><applet><area><article><aside><audio><b><base><basefont><bdi><bdo><big><blockquote><body><br><button><canvas><caption><center><cite><code><col><colgroup><data><datalist><dd><del><details><dfn><dialog><dir><div><dl><dt><em><embed><fieldset><figcaption><figure><font><footer><form><frame><frameset><h1> — <h6><head><header><hr><html><i><iframe><img><input><ins><kbd><label><legend><li><link><main><map><mark><meta><meter><nav><noframes><noscript><object><ol><optgroup><option><output><p><param><picture><pre><progress><q><rp><rt><ruby><s><samp><script><section><select><small><source><span><strike><strong><style><sub><summary><sup><svg><table><tbody><td><template><textarea><tfoot><th><thead><time><title><tr><track><tt><u><ul><var><video>
Create CSS Variables for Theming#
For the tutorial, we’re going to try a bit different technique for theming by using values.
We’ll set a grey for the border, and then break down a blue color to be used in our state into its hsl values, including: for «hue», for «saturation», and for «lightness».
Accessible Contrast
As per all user interface elements, the input border needs to have at least 3:1 contrast against it’s surroundings.
And, the state needs to have 3:1 contrast against the unfocused state if it involves something like changing the border color or, according to , a thickness greater than or equal to .
makes some slight adjustments to requirements, and I encourage you to review them.
JavaScript
JS Array
concat()
constructor
copyWithin()
entries()
every()
fill()
filter()
find()
findIndex()
forEach()
from()
includes()
indexOf()
isArray()
join()
keys()
length
lastIndexOf()
map()
pop()
prototype
push()
reduce()
reduceRight()
reverse()
shift()
slice()
some()
sort()
splice()
toString()
unshift()
valueOf()
JS Boolean
constructor
prototype
toString()
valueOf()
JS Classes
constructor()
extends
static
super
JS Date
constructor
getDate()
getDay()
getFullYear()
getHours()
getMilliseconds()
getMinutes()
getMonth()
getSeconds()
getTime()
getTimezoneOffset()
getUTCDate()
getUTCDay()
getUTCFullYear()
getUTCHours()
getUTCMilliseconds()
getUTCMinutes()
getUTCMonth()
getUTCSeconds()
now()
parse()
prototype
setDate()
setFullYear()
setHours()
setMilliseconds()
setMinutes()
setMonth()
setSeconds()
setTime()
setUTCDate()
setUTCFullYear()
setUTCHours()
setUTCMilliseconds()
setUTCMinutes()
setUTCMonth()
setUTCSeconds()
toDateString()
toISOString()
toJSON()
toLocaleDateString()
toLocaleTimeString()
toLocaleString()
toString()
toTimeString()
toUTCString()
UTC()
valueOf()
JS Error
name
message
JS Global
decodeURI()
decodeURIComponent()
encodeURI()
encodeURIComponent()
escape()
eval()
Infinity
isFinite()
isNaN()
NaN
Number()
parseFloat()
parseInt()
String()
undefined
unescape()
JS JSON
parse()
stringify()
JS Math
abs()
acos()
acosh()
asin()
asinh()
atan()
atan2()
atanh()
cbrt()
ceil()
clz32()
cos()
cosh()
E
exp()
expm1()
floor()
fround()
LN2
LN10
log()
log10()
log1p()
log2()
LOG2E
LOG10E
max()
min()
PI
pow()
random()
round()
sign()
sin()
sqrt()
SQRT1_2
SQRT2
tan()
tanh()
trunc()
JS Number
constructor
isFinite()
isInteger()
isNaN()
isSafeInteger()
MAX_VALUE
MIN_VALUE
NEGATIVE_INFINITY
NaN
POSITIVE_INFINITY
prototype
toExponential()
toFixed()
toLocaleString()
toPrecision()
toString()
valueOf()
JS OperatorsJS RegExp
constructor
compile()
exec()
g
global
i
ignoreCase
lastIndex
m
multiline
n+
n*
n?
n{X}
n{X,Y}
n{X,}
n$
^n
?=n
?!n
source
test()
toString()
(x|y)
.
\w
\W
\d
\D
\s
\S
\b
\B
\0
\n
\f
\r
\t
\v
\xxx
\xdd
\uxxxx
JS Statements
break
class
continue
debugger
do…while
for
for…in
for…of
function
if…else
return
switch
throw
try…catch
var
while
JS String
charAt()
charCodeAt()
concat()
constructor
endsWith()
fromCharCode()
includes()
indexOf()
lastIndexOf()
length
localeCompare()
match()
prototype
repeat()
replace()
search()
slice()
split()
startsWith()
substr()
substring()
toLocaleLowerCase()
toLocaleUpperCase()
toLowerCase()
toString()
toUpperCase()
trim()
valueOf()
Пример использования
<!DOCTYPE html> <html> <head> <title>Пример использования тега <textarea></title> </head> <body> <form> <textarea name = "auth_msg" rows = "10" cols = "45">Здесь Вы можете написать информацию для автора…</textarea><br> <input type = "submit" name = "submitInfo" value = "отправить"> </form> </body> </html>
В данном примере мы создали текстовую область (HTML тег <textarea>), атрибутом name присвоили ей имя (name = «auth_msg»), атрибутом rows задали высоту строк равной десяти символам (rows = «10»), и атрибутом cols указали ширину поля равной 45 символов (cols = «45»).
Кроме того, мы разместили внутри формы кнопку, которая служит для отправки формы (элемент <input> с типом кнопки «отправка формы»: type = «submit»).
Результат нашего примера:
Текстовая область в HTML.
JavaScript
JS Array
concat()
constructor
copyWithin()
entries()
every()
fill()
filter()
find()
findIndex()
forEach()
from()
includes()
indexOf()
isArray()
join()
keys()
length
lastIndexOf()
map()
pop()
prototype
push()
reduce()
reduceRight()
reverse()
shift()
slice()
some()
sort()
splice()
toString()
unshift()
valueOf()
JS Boolean
constructor
prototype
toString()
valueOf()
JS Classes
constructor()
extends
static
super
JS Date
constructor
getDate()
getDay()
getFullYear()
getHours()
getMilliseconds()
getMinutes()
getMonth()
getSeconds()
getTime()
getTimezoneOffset()
getUTCDate()
getUTCDay()
getUTCFullYear()
getUTCHours()
getUTCMilliseconds()
getUTCMinutes()
getUTCMonth()
getUTCSeconds()
now()
parse()
prototype
setDate()
setFullYear()
setHours()
setMilliseconds()
setMinutes()
setMonth()
setSeconds()
setTime()
setUTCDate()
setUTCFullYear()
setUTCHours()
setUTCMilliseconds()
setUTCMinutes()
setUTCMonth()
setUTCSeconds()
toDateString()
toISOString()
toJSON()
toLocaleDateString()
toLocaleTimeString()
toLocaleString()
toString()
toTimeString()
toUTCString()
UTC()
valueOf()
JS Error
name
message
JS Global
decodeURI()
decodeURIComponent()
encodeURI()
encodeURIComponent()
escape()
eval()
Infinity
isFinite()
isNaN()
NaN
Number()
parseFloat()
parseInt()
String()
undefined
unescape()
JS JSON
parse()
stringify()
JS Math
abs()
acos()
acosh()
asin()
asinh()
atan()
atan2()
atanh()
cbrt()
ceil()
clz32()
cos()
cosh()
E
exp()
expm1()
floor()
fround()
LN2
LN10
log()
log10()
log1p()
log2()
LOG2E
LOG10E
max()
min()
PI
pow()
random()
round()
sign()
sin()
sqrt()
SQRT1_2
SQRT2
tan()
tanh()
trunc()
JS Number
constructor
isFinite()
isInteger()
isNaN()
isSafeInteger()
MAX_VALUE
MIN_VALUE
NEGATIVE_INFINITY
NaN
POSITIVE_INFINITY
prototype
toExponential()
toFixed()
toLocaleString()
toPrecision()
toString()
valueOf()
JS OperatorsJS RegExp
constructor
compile()
exec()
g
global
i
ignoreCase
lastIndex
m
multiline
n+
n*
n?
n{X}
n{X,Y}
n{X,}
n$
^n
?=n
?!n
source
test()
toString()
(x|y)
.
\w
\W
\d
\D
\s
\S
\b
\B
\0
\n
\f
\r
\t
\v
\xxx
\xdd
\uxxxx
JS Statements
break
class
continue
debugger
do…while
for
for…in
for…of
function
if…else
return
switch
throw
try…catch
var
while
JS String
charAt()
charCodeAt()
concat()
constructor
endsWith()
fromCharCode()
includes()
indexOf()
lastIndexOf()
length
localeCompare()
match()
prototype
repeat()
replace()
search()
slice()
split()
startsWith()
substr()
substring()
toLocaleLowerCase()
toLocaleUpperCase()
toLowerCase()
toString()
toUpperCase()
trim()
valueOf()
Reset Styles#
As is included in all my tutorials as a modern best practice, we add the following reset first:
As seen in the initial state of the fields across browsers, some standout differences were in border type, background color, and font properties.
Interestingly, and do not inherit from the document like typography elements do, so we need to explicitly set them as part of our reset.
Also of note, an input’s should compute to at least 16px to avoid zooming being triggered upon interaction in mobile Safari. We can typically assume equals , but we’ll explicitly set it as a fallback and then use the newer CSS function to set as the minimum in case it’s smaller than (h/t to Dan Burzo for this idea).
We set our to use the theme variable, and also created a slightly rounded corner.
After this update, we’re already looking pretty good:
It may be difficult to notice in that screenshot, but another difference is the height of each field. Here’s a comparison of the text input to the file input to better see this difference:
Let’s address this with the following which we are applying to our class as long as it is not placed on a :
We included since when it’s not a it’s impossible for an input to be multiline. We also set our height in due to considerations of specifically the file input type. If you know you will not be using a file input type, you could use here instead for flexibility in creating various sized inputs.
But, critically, we’ve lost differentiation between editable and input types. We also want to define with more of a hint that it’s also un-editable, but still interactive. And we have a bit more work to do to smooth over the file input type. And, we want to create our themed state.
JavaScript
JS Array
concat()
constructor
copyWithin()
entries()
every()
fill()
filter()
find()
findIndex()
forEach()
from()
includes()
indexOf()
isArray()
join()
keys()
length
lastIndexOf()
map()
pop()
prototype
push()
reduce()
reduceRight()
reverse()
shift()
slice()
some()
sort()
splice()
toString()
unshift()
valueOf()
JS Boolean
constructor
prototype
toString()
valueOf()
JS Classes
constructor()
extends
static
super
JS Date
constructor
getDate()
getDay()
getFullYear()
getHours()
getMilliseconds()
getMinutes()
getMonth()
getSeconds()
getTime()
getTimezoneOffset()
getUTCDate()
getUTCDay()
getUTCFullYear()
getUTCHours()
getUTCMilliseconds()
getUTCMinutes()
getUTCMonth()
getUTCSeconds()
now()
parse()
prototype
setDate()
setFullYear()
setHours()
setMilliseconds()
setMinutes()
setMonth()
setSeconds()
setTime()
setUTCDate()
setUTCFullYear()
setUTCHours()
setUTCMilliseconds()
setUTCMinutes()
setUTCMonth()
setUTCSeconds()
toDateString()
toISOString()
toJSON()
toLocaleDateString()
toLocaleTimeString()
toLocaleString()
toString()
toTimeString()
toUTCString()
UTC()
valueOf()
JS Error
name
message
JS Global
decodeURI()
decodeURIComponent()
encodeURI()
encodeURIComponent()
escape()
eval()
Infinity
isFinite()
isNaN()
NaN
Number()
parseFloat()
parseInt()
String()
undefined
unescape()
JS JSON
parse()
stringify()
JS Math
abs()
acos()
acosh()
asin()
asinh()
atan()
atan2()
atanh()
cbrt()
ceil()
clz32()
cos()
cosh()
E
exp()
expm1()
floor()
fround()
LN2
LN10
log()
log10()
log1p()
log2()
LOG2E
LOG10E
max()
min()
PI
pow()
random()
round()
sign()
sin()
sqrt()
SQRT1_2
SQRT2
tan()
tanh()
trunc()
JS Number
constructor
isFinite()
isInteger()
isNaN()
isSafeInteger()
MAX_VALUE
MIN_VALUE
NEGATIVE_INFINITY
NaN
POSITIVE_INFINITY
prototype
toExponential()
toFixed()
toLocaleString()
toPrecision()
toString()
valueOf()
JS OperatorsJS RegExp
constructor
compile()
exec()
g
global
i
ignoreCase
lastIndex
m
multiline
n+
n*
n?
n{X}
n{X,Y}
n{X,}
n$
^n
?=n
?!n
source
test()
toString()
(x|y)
.
\w
\W
\d
\D
\s
\S
\b
\B
\0
\n
\f
\r
\t
\v
\xxx
\xdd
\uxxxx
JS Statements
break
class
continue
debugger
do…while
for
for…in
for…of
function
if…else
return
switch
throw
try…catch
var
while
JS String
charAt()
charCodeAt()
concat()
constructor
endsWith()
fromCharCode()
includes()
indexOf()
lastIndexOf()
length
localeCompare()
match()
prototype
repeat()
replace()
search()
slice()
split()
startsWith()
substr()
substring()
toLocaleLowerCase()
toLocaleUpperCase()
toLowerCase()
toString()
toUpperCase()
trim()
valueOf()
Textarea Object Properties
| Property | Description |
|---|---|
| autofocus | Sets or returns whether a text area should automatically get focus when the page loads |
| cols | Sets or returns the value of the cols attribute of a text area |
| defaultValue | Sets or returns the default value of a text area |
| disabled | Sets or returns whether the text area is disabled, or not |
| form | Returns a reference to the form that contains the text area |
| maxLength | Sets or returns the value of the maxlength attribute of a text area |
| name | Sets or returns the value of the name attribute of a text area |
| placeholder | Sets or returns the value of the placeholder attribute of a text area |
| readOnly | Sets or returns whether the contents of a text area is read-only |
| required | Sets or returns whether the text area must be filled out before submitting a form |
| rows | Sets or returns the value of the rows attribute of a text area |
| type | Returns the type of the form element the text area is |
| value | Sets or returns the contents of a text area |
| wrap | Sets or returns the value of the wrap attribute of a text area |


