小编use*_*394的帖子

如何使用jQuery打开Bootstrap模式窗口?

我正在使用Twitter Bootstrap模态窗口功能.当有人点击我的表单上的提交时,我想在单击表单中的"提交按钮"时显示模态窗口.

<form id="myform" class="form-wizard">
    <h2 class="form-wizard-heading">BootStap Wizard Form</h2>
    <input type="text" value=""/>
    <input type="submit"/>
</form>

<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Modal header</h3>
    </div>
    <div class="modal-body">
        <p>One fine body…</p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

$('#myform').on('submit', function(ev) {
    $('#my-modal').modal({
        show: 'false'
    }); 


    var data = $(this).serializeObject();
    json_data = JSON.stringify(data);
    $("#results").text(json_data); 
    $(".modal-body").text(json_data); 

    // $("#results").text(data);

    ev.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap

709
推荐指数
12
解决办法
153万
查看次数

Angular 2/4如何设计棱角分明的材料设计

我是Angular2/4和angular typescript的新手.我想设置角度材料设计小吃吧的样式 ,例如将背景颜色从黑色和字体颜色更改为其他颜色.
我该如何设计"小吃店"?

我在服务/核心中有材料设计零食栏,并且可以根据需要在每个组件中调用它.

如何在Angular 2/4中设置Angular 2材质设计"snackbar"?我在下面列出了代码段:

服务/核心

import { Injectable, Inject } from '@angular/core';
import { Observable } from 'rxjs/Observable'
import { DOCUMENT } from'@angular/platform-browser'; 
import { MdDialog, MdDialogRef } from '@angular/material'; 
import { MdDialogConfig, ComponentType } from '@angular/material'; 
import {MdSnackBar} from '@angular/material';

constructor(
    public dialog: MdDialog,
    public snackBar: MdSnackBar,
    @Inject(DOCUMENT) public doc: any   ) {
      dialog.afterOpen.subscribe((ref: MdDialogRef<any>) => {
        if (!doc.body.classList.contains('no-scroll')) {
        doc.body.classList.add('no-scroll');
        }
      });
      dialog.afterAllClosed.subscribe(() => {
        doc.body.classList.remove('no-scroll');
      });        }

   openSnackBar(message: string, action?: string) { …
Run Code Online (Sandbox Code Playgroud)

angular-material2 angular

19
推荐指数
3
解决办法
3万
查看次数

使用JQuery从JSON或XML提要生成HTML表单

我想使用Jquery创建基于XML或JSON数据的HTML表单,我还计划验证任何可能为空或不正确的表单字段.

我想知道是否有任何其他程序/功能动态生成这样的表单,并且是实现此目的的最佳方式.任何jquery小部件或库最适合工作示例将非常感激

以及在这种情况下最佳使用XML或JSON的原因并解释原因?

谢谢

xml jquery json

17
推荐指数
2
解决办法
6万
查看次数

角度错误 TS2564:属性“users”没有初始值设定项,并且未在构造函数中明确分配

我正在使用 Angular 来使用“ https://coursetro.com/posts/code/171/Angular-7-Tutorial---Learn-Angular-7-by-Example ”中的示例来构建此应用程序。它是一个确切的代码,但我仍然收到“user:Object”
的错误

我该如何修复这个错误?

错误 TS2564:属性“users”没有初始值设定项,并且未在构造函数中明确分配。

12个用户:对象;~~~~~~

Here is the exact code as per website:
import { Component, OnInit } from '@angular/core';
import { DataService } from '../data.service';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
  //h1Style:boolean = false;

  users: Object;

  constructor(private data: DataService) { }

  ngOnInit(): void {
    this.data.getUsers().subscribe(data => {
        this.users = data
        console.log(this.users);
      }
    );
  }


}
Run Code Online (Sandbox Code Playgroud)

我的 Angular 基于 ng 版本:Angular CLI:11.1.2

节点:14.15.4

操作系统:win32 x64

角度:11.1.1 …

typescript angular

17
推荐指数
2
解决办法
2万
查看次数

如何切换extjs主题?

我注意到extjs带有3到4个默认主题/皮肤.如何在主题之间选择或切换?

我想更改蓝色以选择灰色主题或其他内容.

谢谢

extjs

16
推荐指数
1
解决办法
2万
查看次数

如何使用jquery捕获500错误消息?

如何使用jquery捕获500错误消息?我想继续检查500错误消息,直到它发生变化,并在50秒后超时.

我使用下面的代码尝试捕获并检查500错误消息但它似乎没有捕获500错误消息.我可以在萤火虫中看到它

$.ajax({
    statusCode: {
        500: function() {
            alert(" 500 data still loading");
            console.log('500 ');
        }
    }
}); 
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery

16
推荐指数
2
解决办法
2万
查看次数

如何在jquery.datatables中显示复选框?

我正在使用Datatables,我有以下代码来生成表.我想显示read,write,execute和admin值的复选框.如果该值等于1,我想要选中复选框.如果未选中0复选框.

使用Javascript

<script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                var oTable = $('#example').dataTable( {
                     "sScrollY": "500px",                                
                    "bPaginate": false,
                    "bProcessing": true,
                    "sAjaxSource": "sources/sample.json"
                } );


            } );
        </script>
Run Code Online (Sandbox Code Playgroud)

HTML

<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
                    <thead>
                        <tr>
                            <th width="20%">Browser</th>
                            <th width="25%">Read</th>
                            <th width="25%">Write</th>
                            <th width="15%">Execute</th>
                            <th width="15%">Admin</th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                    </table>
Run Code Online (Sandbox Code Playgroud)

JSON

{ "aaData": [
    ["Trident","0","0","0","1"],
    ["Trident","0","1","0","0"],
    ["Trident","0","0","1","1"],
    ["Trident","0","0","1","1"],
    ["Trident","0","0","1","1"],
    ["Trident","0","0","0","0"],
    ["Gecko","1","1","1","1"],
    ["Gecko","0","0","0","1"],
    ["Other browsers","1","0","0","U"]
] }
Run Code Online (Sandbox Code Playgroud)

javascript jquery datatables

14
推荐指数
1
解决办法
4万
查看次数

禁用并启用工具提示无法正常工作

我试图关闭并使用jquery打开引导工具提示切换.但它似乎没有正常工作.我注意到一旦引导工具提示被关闭,它就不会再将工具提示再次打开.如何重新启用工具提示?感谢您的帮助

 .fa-3x {
  background-color: yellow;
}
.fa-lg {
  background-color: blue;
}
.toggle-button-on {
  color: green;
}
.toggle-button-off {
  color: red;
}  
Run Code Online (Sandbox Code Playgroud)

$(document).ready(function() {
  $("ul.nav li ").click(function() {
$(this).toggleClass("toggle-button-on").find(".fa-3x").removeClass("fa-3x").addClass("fa-lg").css("border", "3px solid red");
  });
  $(".nav").on("click", ".toggle-button-on", function() {
$(".toggle-button-on").toggleClass("toggle-button-on toggle-button-off");
$(".nav .fa-3x").toggleClass("fa-3x fa-lg");
$('[data-toggle="tooltip"]').tooltip();
  });
  $(".nav").on("click", ".toggle-button-off", function() {
$(".toggle-button-off").toggleClass("toggle-button-off toggle-button-on");
$(".nav .fa-lg").toggleClass("fa-lg fa-3x");
 $('[data-toggle="tooltip"]').tooltip('disable');
   // $('[rel=tooltip]').tooltip('disable') // Hide and destroy tooltips
  });
});
Run Code Online (Sandbox Code Playgroud)
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- Latest compiled and minified JavaScript …
Run Code Online (Sandbox Code Playgroud)

jquery

6
推荐指数
1
解决办法
1768
查看次数

AWS CodePipeline,构建失败并出现错误

我正在尝试构建和Angular7项目并部署到S3,但遇到以下错误。我该如何解决?

[Container] 2019/05/21 04:08:49 Waiting for agent ping 
[Container] 2019/05/21 04:08:51 Waiting for DOWNLOAD_SOURCE 
[Container] 2019/05/21 04:08:56 Phase is DOWNLOAD_SOURCE 
[Container] 2019/05/21 04:08:56 CODEBUILD_SRC_DIR=/codebuild/output/src345798432/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/CodeCommit-May20 
[Container] 2019/05/21 04:08:56 YAML location is /codebuild/readonly/buildspec.yml 
[Container] 2019/05/21 04:08:56 Processing environment variables 
[Container] 2019/05/21 04:08:56 Moving to directory /codebuild/output/src345798432/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/CodeCommit-May20 
[Container] 2019/05/21 04:08:56 Phase complete: DOWNLOAD_SOURCE State: FAILED 
[Container] 2019/05/21 04:08:56 Phase context status code: YAML_FILE_ERROR Message: This build image requires selecting at least one runtime version. 
Run Code Online (Sandbox Code Playgroud)

amazon-web-services angular

6
推荐指数
1
解决办法
3168
查看次数

如何显示每个单元格的工具提示?

如何修改代码以将每个单元格信息显示为工具提示?

http://datatables.net/release-datatables/examples/advanced_init/events_post_init.html

$(document).ready(function() {
/*
* First step is to create title attributes for the rows in the table
* This isn't needed if the required 'title' attribute is already set in the HTML in the
* DOM
*/
$('#example tbody tr').each( function() {
var sTitle;
var nTds = $('td', this);
var sBrowser = $(nTds[1]).text();
var sGrade = $(nTds[4]).text();

if ( sGrade == "A" )
sTitle = sBrowser+' will provide a first class (A) level of CSS support.';
else if …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-datatables

5
推荐指数
2
解决办法
2万
查看次数