Thursday, November 4, 2010

New Js helper in 1.3: jQueryObject value not being used for get method

I'm trying to the the Js Helper in 1.3. I want to use the Jquery
engine with noConflict mode. Per the Cookbook I put the following in
the layout:

$this->Js->JqueryEngine->jQueryObject = '$j';
print $this->Html->scriptBlock('var $j = jQuery.noConflict();'); //
Tell jQuery to go into noconflict mode

and in the view I have:

$this->Js->get('#some-link');
$this->Js->event('click', $this->Js->alert('hey you!'));

The output is:

<script type="text/javascript">
<![CDATA[
$j(document).ready(function () {$("#some-link").bind("click", function
(event) {alert("hey you!");
return false;});});
//]]>
</script>

The gives a javascript error " $ is not a function ". Cake properly
used my $j value in the domReady method but not in the get method.

-Corie

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: