English 中文(简体)
Jquery s change() versus Javascript s onchange recback possible?
原标题:Jquery s change() versus Javascript s onchange drawback possible?
  1. I have a form where the user can dynamically add fields (clone and increasing index). I use the sheepit plugin for doing this. You don t need to dig into this plugin to answer this question.

  2. <>Inside,本加固田地(将受到装饰和增加指数),具有提醒元素贴现的选定要素(根据投入,它分布不同田地,但可以加以比较说明)。 核查和视察部为这一职能制定了简化的法典。

问题在于,如果用户增加额外领域(1.),则“变换”活动与新的创建领域没有约束力。 因此(2.)没有为新的领域工作。

如果与Javascript合用,并在html上添加交换活动,这将发挥作用。

How can i do this with jquery?

在这里,最简单的法典:

change()

$(document).ready(function() { 
 $( .viewSelector ).change(function() 
    {             
        //GET THE ID            
        var idint = $(this).attr( name );          
        alert(idint);
    });
});

仅在新创建的领域中,我才希望发挥这一职能。

最佳回答

Just use live(:

$(document).ready(function() { 
  $( .viewSelector ).live( change , function() {             
    //GET THE ID            
    var idint = $(this).attr( name );          
    alert(idint);
  });
});

这将使这项活动与人力部所增加的与你的甄选者相对应的任何新内容联系起来。

问题回答

暂无回答




相关问题
jquery change() on input box in IE6 - can t remove focus

I have a checkout page that unobtrusively checks to see whether a customer has ordered from us before. After they fill in their e-mail address and focus to the next box, I look up the e-mail and ...

Putting focus on a textbox in onchange event

I am trying to get it so that when a certain value is put into a textbox, the focus will stay on the textbox(and an alert will be shown in production). I am trying to get this to work in Firefox 3.5.7 ...

Javascript onchange different in IE and FireFox

When this onchange event in IE returns false, IE focus stays on that input box. In Firefox the focus always moves to the next field regardless. HTML: input name="seminar_donation" type="text" id="...

dojo dijit client side validation onchange

So I followed the example in the Dojo - Using the Dojo JavaScript Library to Build Ajax Applications to add server-side validation to the username validationtextbox field on my form. Basically I added ...

onchange attribute won t call function

I have an HTML document (here), which creates an iframe-based media player for a collection of songs within albums (I just used letters to define these albums and songs in the mymusic array, for ...

Internet Explorer file input onchange

I have these dynamically created file input HTML elements which are used with a jQuery-ajax file upload plug-in. I would like the file upload to start after the input value has been updated. However,...

热门标签