<?php if ($amLanguage['id'] == AM_DEFAULT_LANGUAGE_ID){ ?> <!--Set the language & fire a click event using id="admin_language"//--> <input id="admin_language" type="image"
src="<?php echo DIR_WS_CATALOG_LANGUAGES . $amLanguage['directory'] . '/images/' . $amLanguage['image'];?>"
title="<?php echo AM_AJAX_CHANGES;?>"
<?php echo ($attributeManager->getSelectedLanguage() == $amLanguage['id']) ?
'style="padding:1px;border:1px solid #006600;" onclick="return false;"' :
'onclick="return amSetInterfaceLanguage(\\''.$amLanguage['id'].'\\');"';?> > <?php }else{........
?>
What I am trying to achieve is to have jquery fire of the onclick event for the id=“admin_language” above.
I have tried this (loaded as the last snippet within the <head> -tag) which didn’t work:
<script type="text/javascript">
$(document).ready(function() {
$('#admin_language').die('click');
$('#admin_language').live('click', function()
{ // do something
alert('I am here');
$('#admin_language').trigger('click');
});
});
</script>
The alert message appears, but that’s all… I still have to click the image.
Also I have read about delegate() which seems to be better than live() I do have a feeling that all this stuff is well above my head.
So I kindly ask you for the correct way of doing it.
Kind regards
Sara in Sweden