English 中文(简体)
我如何把超5数据价值分配给一个要素?
原标题:How can I assign an HTML5 data value to an element?

我有以下法典:

 $.modal({
                    title: title,
                    closeButton: true,
                    content: content,
                    complete: function () {
                        applyTemplateSetup();
                        $( #main-form ).updateTabs();
                        $( #main-form ).data( action ,action);
                        // updated to line below but still does not work
                        $( #main-form ).data( action , Edit );
                    },
                    width: 900,
                    resizeOnLoad: true,
                    buttons: {
                         Submit : function (win) {
                            formSubmitHandler($( #main-form )); 
                        },
                    }

一旦我的数据装齐后,我就试图确定数据属性行动。 之后,在提交书记员中,我有更多的法典:

var formSubmitHandler = function (form) {

    //e.preventDefault();
    var $form = form;
    var val = $form.valid();
    if (!$form.valid || $form.valid()) {

        var submitBt = $(this).find( button[type=submit] );
        submitBt.disableBt();
        var sendTimer = new Date().getTime();

        $.ajax({
            url: $form.attr( action ),
            dataType:  json ,
            type:  POST ,
            data: $form.serializeArray(),
            success: function (json, textStatus, XMLHttpRequest) {
                json = json || {};
                if (json.success) {
                    if ($form.data( action ) == "Edit") {
                        $( #modal ).removeBlockMessages()
                        submitBt.enableBt();
                    } else {

然而,这一价值似乎并未正确确定,因为我通过该守则,这并不产生真正的价值:$form.data(行动)=“Edit”。 我做了一些错误?

最佳回答

这可能是问题。

First you do - $( #main-form ).data( action ,action);
I m not entirely sure what the actionvariable holds, but from this line of your code - url: $form.attr( action ) I m going to assume you re giving the form action value. Why you do that is your concern, but I do believe it does not == "Edit".

你在<代码>$form.data(行动)上取得了什么价值?

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签