Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JQuery/Javascript not working on Firefox and Chrome

840187Jan 29 2013 — edited Jan 29 2013
Hi guys, I've had this Jquery/Javascript on my page for a long time. This has stopped working. If the user clicks on buttons on the Apex page, nothing happens.
It works on IE but doesn't work on Firefox and Chrome. It used to work fine.

Is there anything I can change to make it work on all 3 browsers?

Firefox error console shows a syntax error at this point in the script:

$allButtons.click(function(){
itemChanged = false;
var toDo = $(this).attr('data-submitval');
eval(toDo);
});

Please can someone help?

This is the full script:

<script type="text/javascript">
//<![CDATA[
var itemChanged = false;

$(document).ready(function(){
var $items = $(':input');
var $htmlButtons = $(':button[id]');
var $templateButtons = $(':button[class]');
var $allButtons = $($htmlButtons).add($templateButtons);

$items.change(function() {
itemChanged = true;
});

$templateButtons.attr('data-submitval', function(){
return $(this).attr('onclick').toString().split('\n')[2];
});

$htmlButtons.attr('data-submitval', function(){
return this.id;
});

$allButtons.removeAttr('onclick');

$allButtons.click(function(){
itemChanged = false;
var toDo = $(this).attr('data-submitval');
eval(toDo);
});

$('a').click(function(event){
if ($(this).children('img[id="P&APP_PAGE_ID._DATE_PICKER_IMG"]').length > 0) {
event.preventDefault();
eval($(this).attr('href'));
}
});
});

window.onbeforeunload = function() {
if (itemChanged) {
return 'You have made changes to data on this page. If you navigate away from this page without first saving your data, the changes will be lost.';
}
};

//]]>
</script>


Thanks

Sam

Edited by: sam on 29-Jan-2013 03:50
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2013
Added on Jan 29 2013
0 comments
342 views