problem description
hundred house number, hit the keyboard to enter, will automatically generate a label. Now I want to generate the label automatically by simulating the carriage return, but the simulated carriage return has not achieved the effect of generating the label
.the environmental background of the problems and what methods you have tried
cycle data, simulate enter
related codes
/ / Please paste the code text below (do not replace the code with pictures)
var arr = ["tag 1" "tag 2" tag 3"]
var len = arr.length;
$(".tags-container").keyup(function(event){
if(event.keyCode ==13){
console.log("")
}
});
$(".remind").click(function(){
$(".tags-container").addClass("focus");
for(var n = 0;n<arr.length;nPP){
/ / console.log (arr [n]);
var val = $(".tags-container input").val();
console.log(val);
$(".tags-container input").focus();
$(".tags-container input").val(arr[n]);
var e = jQuery.Event("keydown");//
e.keyCode = 13;//keyCode=13
$(".tags-container").trigger(e);//
}
})
:
this is typed with the actual enter key