Forum Moderators: open

Message Too Old, No Replies

avoid Conflict execution result error

i dont get it

         

nanat

6:56 am on Feb 25, 2010 (gmt 0)

10+ Year Member



i have a jquery codes close and open animation

Code 1

$(function(){
$(".showlogs").click(function(){

var element = $(this);
var show = element.attr("id");

$.get('index.php',{option:'myReports', task: 'logs', id: show},function(data)
{
$('body').html(data);
$("#logMeIN").show('slow');
});

return false;
})
})

Code 2

<script type="text/javascript">
$(document).ready(function() {
$('a#slick-toggle').click(function() {
$('#bg-wrapper').toggle(400);
return false;
});
});
</script>



how ever when i execute code 1 eventually the code 2 doesn't execute and it will disable my whole code inside my page..

another problem of code 1 if you click 2 or 5 times it only allowed 2 execution the rest turns disable function..

any suggestion guys? :(

daveVk

11:10 am on Feb 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



code 1 appears to replace the entire body

$('body').html(data);

any changes code2 made to original body will be lost.

try replacing

$('body').html(data);

with

$('body').html(data);
$('a#slick-toggle').click(function() {
$('#bg-wrapper').toggle(400);
return false;
});

and delete code 2, this should apply code 2 changes to replaced page rather than original page.

nanat

7:56 am on Feb 26, 2010 (gmt 0)

10+ Year Member



tnx dave i get it ^^..

right syntax:

$("button:#editHide").click(function () {
$("#editFile").hide(1000);
return true;
});
<button id="editHide">hide</button>



wrong syntax:

function showtable(aw)
{
if(aw == 0){
$("#editFile").hide(1000);

location.reload();

}
return false;
}

<input type="button" value="submit"onclick="showtable(0)">


but both are the same result: