Re: [問題] jquery attr onclick IE7 & 8
※ 引述《gaekeamql (芋頭)》之銘言:
: 問一下
: <input type="button" id=1 onclick="alert('001122');" value="alert">
: <input type="button" onclick="$('#1').attr('onclick','');" value="C">
: <input type="button" onclick="$('#1').attr('onclick','alert(\'334455\');');"
: value="RE">
: 此動作在OPREA OK 但是在IE 清除候 再輸入
: $('#1').attr('onclick','alert(\'001122\');'); 卻是沒反應的
: 但是 是有把 oncilck="alert('334455');" 寫進去 但是不會動作
不確定 id 是否可以為數字開頭,另外一般配合 jQuery 是用:
$('#id1').click(function(){
alert('334455');
});
或是:
$('#id1').bind('click', function(){
alert('334455');
});
不確定你是從那邊學來的用法...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.242.135.97
→
01/29 09:02, , 1F
01/29 09:02, 1F
→
01/29 09:18, , 2F
01/29 09:18, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 7 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
33
68