JSFiddle - React, Tailwind, and code Playground
by Qwerty_Wasd
HTML
<div>
<input type="text" class="form-control" name = "nameInformation[]" id="prizName" placeholder="Приз">
</div>
<div class="information_json_plus">
<div>
<span style="float: right; margin-top: 10px;" class="btn btn-success plus pull-right">+</span>
</div>
</div>
<input id="but1" style="margin-top: 10px;" class="btn btn-success" type="button" value="Запросить файл" />
CSS
/* общий стиль */
input[type="checkbox"]{zoom:1.5; }
.hr{border-bottom: 1px solid #000}
.block{ width: 530px; padding: 10px; border: 1px solid #000;float: right; }
.information_json * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* стиль динамических полей*/
.pull-right {float: left;}
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.btn-danger {
color: #fff;
background-color: #d9534f;
border-color: #d43f3a;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
.titleLebel{
line-height: 30px;
padding-left: 20px;
}
span.time{
...
JavaScript
$(document).ready(function(){
$("#prizName").on("mouseup", function(e) {
if(!e.ctrlKey) return;
this.value = this.value.replace(getText(this), "test")
});
});
function getText(elem) { // only allow input[type=text]/textarea
if(elem.tagName === "TEXTAREA" ||
(elem.tagName === "INPUT" && elem.type === "text")) {
return elem.value.substring(elem.selectionStart,
elem.selectionEnd);
// or return the return value of Tim Down's selection code here
}
return null;
}