Is it possible to explode datas in array according to a charachter?
.each(myArr, function(key, value) {
});
i take array like that
value is the values of array . Can explode value with "-" ?
Is it possible to explode datas in array according to a charachter?
.each(myArr, function(key, value) {
});
i take array like that
value is the values of array . Can explode value with "-" ?
Use split()
:
var items = value.split('-');
您可以使用split
var arr = str.split('-');
是的,你使用value.split('-');
你可以这样写
function add_nik(id)
{
$('#modal_form').modal('hide'); // show bootstrap modal
var hasil=id.split(',');
$('#nik').val(hasil[0]);
$('#nama').val(hasil[1]);
}
在你的 html 代码中
<input type="text" name="nama" id="nama" >
<input type="text" name="nik" id="nik>