function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
d.popovd.popov 

Jquery + Prototype + Calendar + tabPanel

SImple VF page it's work perfect.


<apex:page >
    <apex:includeScript value="{!URLFOR($Resource.Xsolla_Jquery_min, '')}"/>
    <apex:includeScript value="{!URLFOR($Resource.Xsolla_Jquery_custom_min, '')}"/>
    <apex:includeScript value="{!URLFOR($Resource.Xsolla_Jquery_timepicker, '')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.Xsolla_Jquery_css, '')}"/> 
 
    <script language="javascript">
           $(function() { 
                            $('#datepicker').datetimepicker({
                                showSecond: true,
                                timeFormat: 'hh:mm:ss',
                                stepHour: 2,
                                stepMinute: 10,
                                stepSecond: 10
                            });
                        }); 
    </script>
      
    <input type="text" name="date" id="datepicker" value="01.06.2009 00:00"/> 
 
</apex:page>

But in on the page tabPanel, 

 

3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript:265Uncaught TypeError: Object [object Object] has no method 'dispatchEvent'
3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript:106Uncaught TypeError: Object [object Object] has no method 'hasClassName'
3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript:106Uncaught TypeError: Cannot read property 'length' of undefined
3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript:107Uncaught TypeError: Cannot call method 'replace' of undefined

I'am add to code, this fix error, but calendar not show

<script type="text/javascript">

         jQuery.noConflict();

</script> 

 

How to fix this problem?


 

d.popovd.popov

Any ideas?

Manuel EcheverriaManuel Echeverria
That is because Jquery is having confilct with the standard libraries from Salesforce. I've found that this happens when you use apex:tabpanel mostly.

If you want to solve this you should include it at the beggining of the script like this

<script>
$j = jQuery.noConflict();
</script>

And wherever you use $ in Jquery change it for $j. For me is working fine and no issues at all.



That's all folks :)...
Spencer BartzSpencer Bartz

To avoid changing $ to $j (e.g. for copy + pasting jQuery code) you can try this:

jQuery(function ($) {
    // The dollar sign will equal jQuery in this scope
});

// Out here, the dollar sign still equals Prototype
See original Stack Overflow question (https://stackoverflow.com/questions/980697/element-dispatchevent-is-not-a-function-js-error-caught-in-firebug-of-ff3-0)