English 中文(简体)
页: 1 当人们再次提出要求时,金字节选择会改变其价值。
原标题:jQuery plugin bsmSelect doesn t update its values when it is called again and its select options have changed

https://github.com/vicb/bsmSelect”rel=“nofollow” j Query plugin。 从根本上说,它正在改变如何使选定多位人才更容易选择。 它掩盖了某些要素,而是列出了一个清单。

因此,在我选定的多功能要素中首先应用原始功能的Im:

$(document).ready(function() {
  ...
  $( #my_select_multiple ).bsmSelect({
    plugins: [$.bsmSelect.plugins.sortable()],
    title:  Add ,
    removeLabel:  Remove 
  });
  ...
});

换言之,我还有另一个部分(这是简单的)内容,它有一项要求,对其变化事件具有约束力。 这项亚克斯请求获得了新的<代码>#my_select_multiple备选办法,视特定简单数值而定。 Ajax的回复是#my_select_multiple备选办法的新的超文本。 因此,我有:

function getNewOptions(val) {
  var r = $.ajax({
    type:  GET ,
    url: /*My URL*/
  }).responseText;
  return r;
}

...

$(document).ready(function() {
...
  $( #my_select_simple ).change() {
    $( #my_select_multiple ).html(getNewOptions($(this).val()));
  }
...
});

复兴共和军正在按预期开展工作。 新的备选办法是正确的,并插入#my_select_multiple。 (这为蓝色白金所掩盖,但我可以用火力检查。) 但是,当选人并没有实现新的变化,也没有获得更新。

因此,我认为我要再次使用<代码>(#my_select_multiple .bsmSelect();及其新的选择。

我先看一看,这里是我所尝试的。

<>1>。 I ve试图再次打电话给美国宇宙航空研究开发机构要求的successcomplet(一时)。 零工

function getNewOptions(val) {
  var r = $.ajax({
    type:  GET ,
    url: /*My URL*/,
    success: function() { $( #my_select_multiple ).bsmSelect(); }
  }).responseText;
  return r;
}

2. I ve tried to bind the function with the on jQuery function. Didn t work:

$( #my_select_simple ).on( change , function() {
  $( #my_select_multiple ).bsmSelect();
});

<>3>。 I ve尝试了1和2,预先排除了电灯产生的超文本。 零工。

非常感谢。

<><>UPDATE: 确切代码

第一,有“全球编码”。 选用一些选定的多种产品(.quizzes):

$( .quizzes ).bsmSelect({
  plugins: [$.bsmSelect.plugins.sortable()],
  title:  Add ,
  removeLabel:  Remove 
});

然后,在文件I中界定了<代码>更新日期Quizzes的功能,并将其与选定的简单功能(project_id)相约束。 变化活动:

<script type="text/javascript">
  function updateQuizzes(project_id) {
    var r = $.ajax({
    type:  GET ,
url:  <?php echo url_for( event/updateQuizzes )?> + <?php echo   ($form->getObject()->isNew()?  : ?id= .$form->getObject()->getId()).($form->getObject()->isNew()? ?project_id= : &project_id= )?> +project_id,
    success: function() { $( .quizzes ).bsmSelect({
      plugins: [$.bsmSelect.plugins.sortable()],
      title:  Add ,
      removeLabel:  Remove 
    }); }
  }).responseText;
  return r;
  }

  $( #project_id ).change(function(){
    $( .quizzes ).html(updateQuizzes($(this).val()));
  });
</script>

正如我所告诉的那样,复兴共和与民主军的要求没有问题,而是没有问题。 第二次选择......

最佳回答
问题回答

Not sure if this is what the problem is, but you could try

$( #my_select_simple ).change() {
    $( #my_select_multiple ).html(getNewOptions($(this).val())).trigger( change );
}

这触发了选定“多功能”的变更活动,并可能焚烧电灯。 我不敢肯定,这里的问题究竟是什么,但我能最充分地提出这个问题。

我认为,你希望在阿贾克斯呼吁的<条码>中设定你的超文本,例如:

function loadNewOptions(val) {
    $.ajax({
        type:  GET ,
        url: /*My URL*/,
        success: function(data) { 
            $( #my_select_multiple ).html(data).bsmSelect(); 
        }
    });
}

接着说:

$( #my_select_simple ).change() {
    loadNewOptions($(this).val());
}
$(document).ready(function() {

  $( #my_select_simple ).change() {
    $( #my_select_multiple ).load("your Url", function(){
        $( #my_select_multiple ).bsmSelect();
    });
  }

});

这样的工作就是这样。

<代码> 载 ,将任何您的升温带入#my_select_multiple

第1项参数是装载的旋涡,第2项功能是在装载时起。 这正是你需要设立你的精选机构。





相关问题
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.

热门标签