请帮我结合两个jquery脚本。目前,它们彼此不兼容。我该怎么做才能让他们俩都友好。
查询:
<script>
function edit_product() {
var id = $('.DIVY.panel3').attr('id');
alert (id);
</script>
<script>
$(function(){
$('.DIVY').click(function(){
$('.DIVY.panel3').removeClass('panel3').addClass('panel2');
$(this).removeClass('panel2').addClass('panel3');
})
})
</script>
html:
<div id="1" class="DIVY panel2" >click me please!</div>
<div id="2" class="DIVY panel2" >click me please!</div>
<div id="3" class="DIVY panel3" >click me please!</div>
<div id="4" class="DIVY panel2" >click me please!</div>
<div ><a href="#" onclick="edit_product()">Check ID</a></div>
为了更好的可视化,我把这段代码放到了My_jsfiddle
谢谢大家的努力!