我的textarea的id是字符串和这种格式
ID = '费舍尔[27] .MAN'
我想克隆textarea并增加数字并获取id,fisher[28].man并将其添加到现有的textarea.
有没有办法用jquery轻松完成这项工作?
var existingId = $("#at textarea:last").attr('id');
var newCloned = lastTextArea.clone();
var newId = newCloned.attr('id');
//add the index number after spliting
//prepend the new one to
newCloned.prepend("<tr><td>" + newCloned + "</td></tr>");
Run Code Online (Sandbox Code Playgroud)
必须有更简单的克隆方法,获取索引号,拆分和前置.
我也尝试用regEx做到这一点
var existingIdNumber = parseInt(/fisher[(\d+)]/.exec(s)[1], 10);
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我吗?
如何在IE中垂直调整我的textarea?
我做了调整大小:垂直,它在Firefox中运行良好,但在IE中它不起作用.那么有什么替代方案呢?
此外,如果我想打印页面,那么我需要textarea扩展和打印框中的所有内容.我该怎么用?
编辑 -
我的CSS:
@media screen {
textarea {
resize: vertical;
overflow: auto;
border: 1px #999999 solid;
padding: 6px;
background: #ffffff url('../images/field_bg.png') repeat-x bottom;
width: 400px;
height: 100px;
}
}
@media print {
textarea {
border: 1px #999999 solid;
padding: 6px;
background-color: #ffffff;
background-image : none;
width: 400px;
height: auto;
overflow: visible;
}
}
.field {
display: inline;
vertical-align: top;
width: 25%;
}
Run Code Online (Sandbox Code Playgroud)
HTML -
<div class="field">
<textarea id="xp">
some text here
</textarea>
</div>
Run Code Online (Sandbox Code Playgroud)
编辑 -
我仍然无法找到解决方案.有人可以帮忙吗?