Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content in popover works only with function #812

Closed
mgrishko opened this issue Dec 15, 2011 · 11 comments
Closed

Content in popover works only with function #812

mgrishko opened this issue Dec 15, 2011 · 11 comments

Comments

@mgrishko
Copy link

I tried with the code from demo, and saw a blank content:
a href="#" class="btn danger" rel="popover" data-content="And here's some amazing content. It's very engaging. right?" data-original-title="A title">hover for popover</a

  <script>
        $(function () {
          $("a[rel=popover]")
            .popover({
              offset: 10,
              content: "some other text"
            })
            .click(function(e) {
              e.preventDefault()
            })
        })
      </script>

But if I use this code, all works fine:

     <script>
        $(function () {
          $("a[rel=popover]")
            .popover({
              offset: 10,
              content: function() {return 'some text';}
            })
            .click(function(e) {
              e.preventDefault()
            })
        })
      </script>
@SimonMacIntyre
Copy link

I am having same problem, but your work-around doesn't fix it for me.
If you view the source code, their example is slightly different then what you posted, what you posted is what I see when I inspect element, but the source code is more accurate I think...

@mgrishko
Copy link
Author

I'm update code, but first and last symbol in html, < and >,I delete. Because markdown formating link.

@SimonMacIntyre
Copy link

I got mine working.

@noosphere2
Copy link

I agree that using a string as value for 'content' option results in no text appearing. Likewise, if you try using a string for the 'title' option, the title appears in the popover but the text will always say 'undefined'.

mikhailaleksandrovi4 is right in that if you pass a function instead of a string and return a string from the function, both the title and content will appear correctly.

@fat
Copy link
Member

fat commented Dec 25, 2011

This is fixed in 2.0

@fat fat closed this as completed Dec 25, 2011
@fat
Copy link
Member

fat commented Dec 25, 2011

Also, in 1.* content when a string specifies not a text option, but rather an element attribute to be used to fetch text from. This was changed in 2.0 because it didn't make a lot of sense.

@swilliams
Copy link

Here's a jsFiddle of it working using functions: http://jsfiddle.net/KGy6Z/2/

(Note this is for Bootstrap 1.4)

@nilskp
Copy link

nilskp commented Jun 22, 2012

This still doesn't work. Try the jsfiddle from swilliams.

@mckramer
Copy link
Contributor

It works fine. That jsFiddle points to the 1.4.0 version of the JS. Here, I forked it to use 2.0.2 version.

@nilskp
Copy link

nilskp commented Jun 22, 2012

Weird. I did click the 2.0.2 checkbox and it didn't work.

Anyway, thanks for confirming!

@swilliams
Copy link

I think if you explicitly add a library with the same functions (like I did with 1.4), it'll override checkboxed ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants