You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using jQuery library, there is an extra "#" before the popup fragment. The generated JavaScript is like this:
$(document).ready(function(){
$("#<div id="popup_0" style="display:none;">...</div>\n\n").appendTo("#popups");
});
My call to Popup->link() is:
echo $this->Popup->link('', array(
'class'=>'my-class',
'element' => '/my_element',
'library' => 'jQuery',
'escape' => true,
'draggable' => true
));
And a JavaScript error will be reported in Firebug:
Error: Syntax error, unrecognized expression: #
If I remove the "#" in PopupHelper's __buildJsDomReady() like the following, and the problem will disappear.
function __buildJsDomReady($popup){
if ($this->library == 'Jquery') {
return $this->Html->scriptBlock('
$(document).ready(function(){
$("'.$popup.'").appendTo("#popups");
});
');
// previous: $("#'.$popup.'").appendTo("#popups");
} else {
// ...
}
}
I am not sure if there is a problem in my usage or it's a bug. Maybe there are other cases to consider.
Thanks for the great plugin!
The text was updated successfully, but these errors were encountered:
blackpuppy
changed the title
# before popup fragment using jQuery
# before popup HTML fragment using jQuery
Jul 26, 2014
When using jQuery library, there is an extra "#" before the popup fragment. The generated JavaScript is like this:
$(document).ready(function(){
$("#<div id="popup_0" style="display:none;">...</div>\n\n").appendTo("#popups");
});
My call to Popup->link() is:
echo $this->Popup->link('', array(
'class'=>'my-class',
'element' => '/my_element',
'library' => 'jQuery',
'escape' => true,
'draggable' => true
));
And a JavaScript error will be reported in Firebug:
Error: Syntax error, unrecognized expression: #
If I remove the "#" in PopupHelper's __buildJsDomReady() like the following, and the problem will disappear.
function __buildJsDomReady($popup){
if ($this->library == 'Jquery') {
return $this->Html->scriptBlock('
$(document).ready(function(){
$("'.$popup.'").appendTo("#popups");
});
');
// previous: $("#'.$popup.'").appendTo("#popups");
} else {
// ...
}
}
I am not sure if there is a problem in my usage or it's a bug. Maybe there are other cases to consider.
Thanks for the great plugin!
The text was updated successfully, but these errors were encountered: