javascript - 使用 JavaScript 检查频道 ID
问题描述
我的表格是这样的,它可能有手动社交网络
我想让用户输入频道的 ID,使用@
.
例如
- @oxbir
- @网站
用户可以使用 URL 输入,例如https://t.me/oxbir。
如何使用 JavaScript 进行验证?
我不想输入 URL,我想输入频道的 if。@oxbir
刀
function showDynamicSocial() {
let html = '' +
'@foreach(auth()->user()->socials as $social)\n'+
'<div class="col-md-6 position-relative">\n' +
'<i class="fas fa-times text-danger position-absolute"></i>' +
'<div class="row">\n' +
'<div class="col-md-4">\n' +
'<div class="form-group">\n' +
'<label for="social_id">Social Network</label>\n' +
'<select id="social_id" name="social_id[]" class="form-control">\n' +
'@foreach($socials as $socialData)\n'+
'<option value="{{ $socialData->id }}" {{ $socialData->id == $social->id ? 'selected' : ''}}>\n'+
'{{ $socialData->name }}\n' +
'</option>\n' +
'@endforeach\n' +
'</select>\n' +
'</div>\n' +
'</div>\n' +
'<div class="col-md-8">\n' +
'<div class="form-group">\n' +
'<label for="link">Profile ID</label>\n' +
'<input id="link" value="{{ $social->pivot->link }}" name="link[]" class="form-control">\n' +
'</div>\n' +
'</div>\n' +
'</div>\n' +
'</div>\n ' +
'@endforeach';
$('#showSocial').append(html);
}
javascript
$('div .btn-next').on('click', function() {
var parent_fieldset = $(this).parents('fieldset');
var next_step = true;
var current_active_step = $(this).parents('div').find('.form-wizard.active');
var progress_line = $(this).parents('div').find('.progress-line');
if( next_step ) {
parent_fieldset.fadeOut(400, function() {
current_active_step.removeClass('active').addClass('activated').next().addClass('active');
bar_progress(progress_line, 'right');
$(this).next().fadeIn();
scroll_to_class( $('.wizards'), 20 );
});
}
});
解决方案
推荐阅读
- javascript - 检查javascript上的单元格是否不为空
- java - 有 DTO 时如何在 Spring MVC 中进行验证?
- c++ - 将变量作为基类对象迭代,同时转换为子类并在 C++ 中使用它们的覆盖方法
- r - ggplot中计数的累积堆积面积图与R
- c# - 我们如何将 ASP.NET Core Web API 与 JS fetch 一起使用?
- python - Python将下载的文件读取为熊猫数据框
- ios - 创建 Mac 版本的 iOS 应用程序,构建错误
- javascript - 为什么 GET ajax 调用返回错误代码 500?
- r - ggplot2 box_plot 添加观察次数
- google-maps - 如何在 Google 地图中的标记点击上打开地图叠加层