Hello guys.. it's i first time i'm asking here. Sorry if the answer is available already.
I have a very small jQuery script that canges the paramether for onclick attr on a DIV.
IT works like as right and left arrows for some content in the middle.
Basically i set the onclick="foo(1)"
then when get clicked sld change the value 1 to 2, and keep changing everytime i click.
on jQuery functio i'm using:
$("#v_arrow_r").attr('onclick','').unbind().click(newclick_next);
it works like a charm on FF and Chrome, but does not work on IE !!!! Argh...
here the the code:
if (start == 24) {
var a = 0;
var b = 0;
} else {
var a = start-6;
var b = start+6;
}
next = "home_featured_videos(" + b + ");";
newclick_next = eval("(function(){"+next+"});");
prev = "home_featured_videos(" + a + ");";
newclick_prev = eval("(function(){"+prev+"});");
$('#video-module').css('background','');
$('#video-module').html(response);
$("#v_arrow_l").attr('onclick','').unbind().click(newclick_prev);
$("#v_arrow_r").attr('onclick','').unbind().click(newclick_next);
The html:
<div id="videos-home">
<div class="arrow-l" id="v_arrow_l" onclick="home_featured_videos(0);"></div>
<div class="content" id="video-module">
//CONTENT
</div>
<div class="arrow-r" id="v_arrow_r" onclick="home_featured_videos(6);"></div>
<div class="clear_b"></div>
</div>
So like i said.. i define the attr onclick when page open. It work well on IE. but when i click the arrow and call the function the oncli is set to null and i add the function to .click. IE stop working. the click is dead.
If anybody have idea why this is happening.
Thanx in advance. Kind Regards
Varois