Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML-JS-如果选择instagram并打开文本框,则必须填充文本框_Javascript_Php_Html - Fatal编程技术网

Javascript HTML-JS-如果选择instagram并打开文本框,则必须填充文本框

Javascript HTML-JS-如果选择instagram并打开文本框,则必须填充文本框,javascript,php,html,Javascript,Php,Html,嗨,伙计们,我有你们的要求提前谢谢。如果在“我的选择”框中选择instagram,并且文本框已打开,则必须填充文本框 我在输入选项中添加了“必选”选项,虽然代码有效,但instagram会要求您在文本框中输入文本,即使未选中文本框 <a><b>The Platform You Order:</b></a> <script src="https://ajax.googleapis.com/ajax/libs/jque

嗨,伙计们,我有你们的要求提前谢谢。如果在“我的选择”框中选择instagram,并且文本框已打开,则必须填充文本框

我在输入选项中添加了“必选”选项,虽然代码有效,但instagram会要求您在文本框中输入文本,即使未选中文本框

<a><b>The Platform You Order:</b></a>         
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<select class="selectdiv2" id="selection2" name="platform" required>
    <option value=""></option>
    <option value="WhatsApp">WhatsApp</option>
    <option value="Instagram">Instagram</option>
</select>
                               
<div id="iii" style="display:none;">
    <br>
    <input class="input1" type="text" name="username" placeholder="Instagram Username:" type='radio' data-target='select_raido3' class='myRadioooo' > 
</div>
        
<script>
$(document).ready(function()
{
    $('#selection2').on('change', function()
    {                       
        if (this.value == 'Instagram')
        {
            $("#iii").show();
        }else{
            $("#iii").hide();
            $('.mySelect2').hide();
        }
    });

    $('.myRadioooo').click(function(){
        $('.mySelect2').hide();
        $('#' + $(this).data('target')).show();
    });
});
</script>
您订购的平台:
WhatsApp
一款图片分享应用

$(文档).ready(函数() { $('#selection2')。在('change',function()上 { 如果(this.value==“Instagram”) { $(“#iii”).show(); }否则{ $(“#iii”).hide(); $('.mySelect2').hide(); } }); $('.myRadiooo')。单击(函数(){ $('.mySelect2').hide(); $('#'+$(this.data('target')).show(); }); });
fyi,您的输入有
type=“text”
type='radio'
使用“required”作为属性将一直需要它。提交数据之前,请检查Instagram是否已选中,文本框是否已打开,文本框值是否为空。如果是这样,停止提交,让用户知道需要什么。那么,我应该怎么做??