小编Jak*_*itz的帖子

为什么jquery sortable中的update事件在测试ui.sender时似乎运行了两次

我正在使用jQuery UI排序来对连接列表进行排序.更新事件似乎正在运行两次.

这是完整的可排序电话:

$(".pageContent").sortable({
    handle: ".quesText",
    connectWith: ".pageContent",
    containment: "section",
    start: function(e, ui){
        ui.placeholder.height(ui.item.height());
    },
    placeholder: "sortable-placeholder",
    opacity: 0.5,
    cursor: "move",
    cancel: "input, select, button, a, .openClose",
    update: function(e, ui){
        var thisItem = ui.item;
        var next = ui.item.next();
        var prev = ui.item.prev();

        var thisNumber = thisItem.find(".quesNumb");
        var nextNumber = next.find(".quesNumb");
        var prevNumber = prev.find(".quesNumb");

        var tn = parseInt(thisNumber.text());
        var nn = parseInt(nextNumber.text());
        var pn = parseInt(prevNumber.text());

        var quesNumbs = $(".quesNumb");

        var newItemId = thisItem.attr("id").replace(/_\d+$/, "_");

        //test if we are dragging …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui-sortable

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

如何禁用和重新启用隐藏/可见元素的tabindex?

如何tabindex根据元素是否可见(在可查看区域中)更改元素?我想做其中一件事:tabindex在进入新部分时重置电流并为该部分tabindex中的元素分配新的电流.或者能够禁用和重新启用tabindex某些元素.

HTML:

    <div id="nav">
        <a id="firstLink" href="#section1" tabindex="1">Go to section 1</a>
        <a id="secondLink" href="#section2" tabindex="2">Go to section 2</a>
    </div>
    <div id="container">
        <div id="section1">
            <a href="#" tabindex="3">Specific to section 1</a>
        </div>
        <div id="section2">
            <a href="#" tabindex="3">Specific to section 2</a>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

如果链接部分可见,我希望链接仅在Tab键顺序中.

CSS:

    #container{
        overflow: hidden;
        width: 400px;
        height: 400px;
    }

    #section1{
        background: red;
        width: 400px;
        height: 400px;
    }

    #section2{
        background: green;
        width: 400px;
        height: 400px;
    }
Run Code Online (Sandbox Code Playgroud)

实例:http://jsfiddle.net/2UF3n/5/

html javascript css jquery

8
推荐指数
1
解决办法
9608
查看次数

Select2 - 在formatNoMatches上链接

我正在使用Select2来增强我的<select>输入.我填充了<options>coldfusion和sql.formatNoMatches如果用户搜索中没有匹配项,我想用来添加选项.我不希望使用多选,因为它不符合我的ColdFusion的工作,再加上它就会简单得多只需一个点击事件添加到formatNoMatches.

在select2.js的某处,有一些代码可以阻止鼠标事件的发生formatNoMatches.有没有办法破解它将允许鼠标事件?

$(".select").select2({
    allowClear: true,
    blurOnChange: true,
    openOnEnter: false,
    formatNoMatches: function(term) {
        return "<a href='#' onclick='alert('" + term + "');'"
          + "id='newClient'>Add New Client</a>";
    }
});
Run Code Online (Sandbox Code Playgroud)

我无法得到上面的代码来提醒任何事情.

coldfusion jquery jquery-select2

5
推荐指数
1
解决办法
6121
查看次数

select2 ajax不会显示返回的json数据

以下是从我的coldfusion页面返回的json字符串的样子:[{"client":"Asante","id":12},{"client":"City of Lancaster","id":14},{"client":"Massey Energy","id":35},{"client":"Northeast Utilities","id":68},{"client":"Washtenaw","id":50}].Firebug声称一切都运行良好但没有数据出现在select2插件中.

有谁知道问题可能是什么?它应该返回列名还是什么?

select2通话:

$(".select").select2({
    allowClear: true,
    blurOnChange: true,
    openOnEnter: false,
    ajax: {
        url: "/surveymanagement/admin/client.cfc",
        dataType: 'json',
        data: function (term, page) {
            return {
                method: "GetClientsByName",
                name: term
            };
        },
        results: function (data, page) {
            return { results: data };
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

jquery json jquery-select2

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

为什么 Formik.setStatus 不更新我表单中的状态状态?

我正在使用 Formik 在 React 中创建一个通用的联系表单。我正在从我的 api 获取数据并尝试调用 FormiksetStatus以生成一条消息以显示表单已成功提交。

无论出于何种原因,Status状态永远不会更新以反映我放入的内容setStatus

这是我的代码:

import { Formik, Form, useField } from "formik";
import * as Yup from "yup";
import axios from "axios";
import Button from "components/shared/button";
import "styles/contact/form.scss";

const handleSubmit = (values, actions) => {
    axios.post("http://localhost:5000/sendemail/", values).then(res => {
        actions.setSubmitting(false);
        actions.setStatus = {
            message: res.data.message
        };
        setTimeout(() => {
            actions.resetForm();
        }, 3000);
    });
};

const FormField = ({ label, tagName, ...props }) => {
    const [field, meta] = …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs formik

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