문제

I would like to use a lightbox plugin (lightbox_me for this case) to lightbox a html DOM element returned by an ajax request.

Here is my code:

<script src="script/jquery.lightbox_me.js"></script>

<script>

 $("#about").click(function(e){
  e.preventDefault();
 $.ajax({
  url : "about.html",
  success : function(html){
  (html).lightbox_me();
 });
});

</script>

However the lightbox doesn't shows up. I have a console message which says:

has no method 'lightbox_me'

도움이 되었습니까?

해결책

Your missed out a $ sign

<script src="script/jquery.lightbox_me.js"></script>

<script>

 $("#about").click(function(e){
  e.preventDefault();
 $.ajax({
  url : "about.html",
  success : function(html){
  //A dollar sign must be before the (html)
  $(html).lightbox_me();
 });
});

</script>

다른 팁

this line should be?

 (html).lightbox_me();

or so:

 $(html).lightbox_me();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top