如何用javascript将输入字段中的第一个字母大写?

时间:2016-09-14 07:18:48

标签: javascript html

当我输入内容时,我想只使用javascript在输入字段中将句子的第一个字母大写。

这是我想要使用它的网站link

有什么解决方案吗?

这是我的HTML代码:

#! /bin/bash
DUMPALL='/usr/bin/pg_dumpall'
PGDUMP='/usr/bin/pg_dump'
PSQL='/usr/bin/psql'

# directory to save backups in, must be rwx by postgres user
BASE_DIR='/media/attachment/backups/postgres'
YMD=$(date "+%Y-%m-%d-%T")
DIR="$BASE_DIR/$YMD"
mkdir -p "$DIR"
cd "$DIR"

# get list of databases in system , exclude the tempate dbs
DBS=($($PSQL --list --tuples-only |
          awk '!/template[01]/ && $1 != "|" {print $1}'))

# first dump entire postgres database, including pg_shadow etc.
$DUMPALL --column-inserts | gzip -9 > "$DIR/db.out.gz"

# next dump globals (roles and tablespaces) only
$DUMPALL --globals-only | gzip -9 > "$DIR/globals.gz"

# now loop through each individual database and backup the
# schema and data separately
for database in "${DBS[@]}" ; do
    ALL="$DIR/$database.all.backup" 
 #dump all
    $PGDUMP -Fc "$database" > "$ALL"
done

# delete backup files older than 3 days
echo deleting old backup files:
find "$BASE_DIR/" -mindepth 1 -type d -mtime +3 -print0 |
    xargs -0r rm -rfv

1 个答案:

答案 0 :(得分:0)

调用此功能并在每次按键时将文本设置为输入

function titleCase(string) { 
return string.charAt(0).toUpperCase() + string.slice(1); 
}