Hi,
I have such js code:
$(document).ready(function(){
$('#a').click(function() {
alert('Handler for .click() called.');
});
});
And I have a link in my page
<a id = "a" href="url">Link text</a>
I checked the view source of web page, scripts are loaded, my js file is called bannerUpload:
<script type="text/javascript" src="/joomla15/media/system/js/mootools.js"></script>
<script type="text/javascript" src="/joomla15/media/plg_jblibrary/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/joomla15/includes/js/joomla.javascript.js"></script>
<script type="text/javascript" src="http://localhost/joomla15/components/com_banerioIkelimas/js/bannerUpload.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
In view file I use this code to load my script:
<?php
$document = &JFactory::getDocument();
//$document->addScript(base_url().'media/js/libs/valums-ajax-upload/ajaxupload.js');
$document->addScript( base_url().'components/com_banerioIkelimas/js/bannerUpload.js' );
?>
I get error
Uncaught TypeError: Cannot call method 'click' of null
Any idea why do I get that error?