占位符文本在textarea内切割

时间:2013-07-10 06:15:00

标签: html5 cordova

<textarea class="skinCondition-field vlongtext clear ui-input-text ui-body-d ui-corner-all ui-shadow-inset" type="text" placeholder="Update details of your present skin condition (e.g. normal, dry, flaky, etc). Optionally, add details of any past skin conditions, medication or skin treatments/surgeries undergone. You may also upload images/reports, so that doctors understand your condition better." value=""></textarea>

CSS:

textarea.ui-input-text.skinCondition-field {
    height:10.5em;
    white-space: normal;
    word-wrap: break-word;
    display: block;     
    word-wrap: break-word !important;
    white-space: normal!important;
    width: 100%;
}

甚至尝试过

textarea.ui-input-text.skinCondition-field::-webkit-input-placeholder {white-space: normal!important; word-break: break-all !important;word-wrap: break-word !important;}

但是这个问题在galaxy s3中仍然存在。

3 个答案:

答案 0 :(得分:1)

查看this FIDDLE是否有帮助。 !

点击上面的链接。

textarea.ui-input-text.skinCondition-field {
    height:10.5em;
    white-space: normal;
    word-wrap: break-word;
    display: block;     
    word-wrap: break-word !important;
    white-space: normal!important;
    width: 100%;
}

修改 在这种情况下,提问者需要一个MULTI-LINE PLACEHOLDER! 你也可以这样:

#text1::-webkit-input-placeholder::after {
    display:block;
    content:"Line 2\A Line 3";
}



#text2::-webkit-input-placeholder{
    color:transparent;
}

#text2::-webkit-input-placeholder::before {
    color:#666;
    content:"Line 1\A Line 2\A Line 3\A";
}

虽然,PLACEHOLDER文字仅供参考!因此,对于较长的文本,请使用<title>

答案 1 :(得分:1)

$('textarea')
    .addClass('placeholder')
    .each(function () {
        $(this).val($(this).attr('placeholder'));
    })

$('textarea').bind({
    'focus': function () {
        var placeholder = $(this).attr('placeholder');
        $(this)
            .removeClass('placeholder');

        if ($(this).val() == placeholder) {
            $(this).val('');
        }
    },
    'blur': function () {
        var placeholder = $(this).attr('placeholder');

        if ($(this).val() == '') {
            $(this)
                .val(placeholder)
                .addClass('placeholder');
        }
    }
});

答案 2 :(得分:0)

我不确定但是尝试删除您的课程然后尝试

<textarea type="text" placeholder="Update details of your present skin condition (e.g. normal, dry, flaky, etc). Optionally, add details of any past skin conditions, medication or skin treatments/surgeries undergone. You may also upload images/reports, so that doctors understand your condition better." value=""></textarea>