document.getElementById().value and document.getElementById().checked not working for IE

前端 未结 4 1820
礼貌的吻别
礼貌的吻别 2020-12-30 23:29

I tried to assign a new value into the hidden input and checkbox of an input form. It\'s working fine in Firefox but not in IE (I\'m using IE 7). Does anyone know what is wr

4条回答
  •  别那么骄傲
    2020-12-30 23:51

    Have a look at jQuery, a cross-browser library that will make your life a lot easier.

    var msg = 'abc';
    $('#msg').val(msg);
    $('#sp_100').attr('checked', 'checked');
    

提交回复
热议问题