开发者

jquery not working in internet explorer using mvc

开发者 https://www.devze.com 2022-12-29 15:49 出处:网络
i havea group of radio buttons that are generated on the fly from the db into a partial control then rendered on the page as html and they all have the same name

i have a group of radio buttons that are generated on the fly from the db into a partial control then rendered on the page as html and they all have the same name now in firefox and chrome the following code works fine

$(".Fligh开发者_运维知识库tSelectedRadio").live('click', function() {
    alert("after flight select");
    $("#ToisGarantueedBid").attr("disabled", false);
});

however in ie it doesnt work on the first select of a radio but only fires if u select something else ? any ideas wat the problem is ?


Lazarus, is right! The code you are writing should be executed after JQuery's page ready event fires which can be accomplished in two ways.

1) Like Lazarus

$(function() { 
     // your code here.
});

2) Or tying in to the document object ready event.

$(document).ready(
   function() {
       // your code here.
   }
);


yeah the radios are getting populated by jquery ajax call, i have managed to get it to work by using the change function isntead thanks for the help

0

精彩评论

暂无评论...
验证码 换一张
取 消