On 05/06/2011 2:42 PM, Tod wrote:
> On 05/06/2011 2:39 PM, Tod wrote:
>> On 05/06/2011 2:07 PM, Krinkle wrote:
>>> Tod wrote:
>>>
>>>> Bottom of LocalSettings.php:
>>>> // Include jQuery
>>>> function wfIncludeJQuery() {
>>>> global $wgOut;
>>>> $wgOut->includeJQuery();
>>>> }
>>>> $wgExtensionFunctions[] = 'wfIncludeJQuery';
>>>>
>>>>
>>>> Common.js:
>>>> $( document ).ready( function() {
>>>> $( '#p1' ).html( 'New text by jQuery!' );
>>>> });
>>>>
>>>>
>>>> /testPage:
>>>> <p id="p1">Hello World!</p>
>>>>
>>>>
>>>> Not working. Best way to debug?
>>>>
>>>>
>>>> Thanks - Tod
>>>
>>> * Put alert( $( '#p1' ).length ); inside the document-ready function.
>>> * Visit the page with<p id="p1">, what's in the alert ?
>>> ** If something other than '1', there's a bug
>>> * Remove alert() ;-)
>>
>> Alert not working. I added an alert outside of the function too and it
>> isn't working. Looks like javascript isn't working on my 1.16.4 install.
>
> Scratch that, outside alert works. Inside alert isn't working.


Found it!  The default $ function jQuery uses has been renamed to $j in 
MW to avoid conflict.  See the first line here:

http://www.mediawiki.org/wiki/JQuery




_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to