jquery - How to attach a popover to fontawesome icon -


ok, so, have text input box. have fontawesome icons in textbox.

i trying trigger popover (from twitter bootstrap 3) box upon click on 1 of fontawesome.

nothing seems work.

however, catch seems file backbone. or @ least .hamlc

here contents of file:

    %form#new-message-form{:name => 'message'}       .input-group.input-group-unstyled         %input#content.form-control.chat-input{:name => 'content', :type => 'text', :placeholder => 'your message ...'}         %span.input-group-addon           %i.fa.fa-paperclip           %i.fa.fa-star           %i.fa.fa-clock-o       .chat-send 

one of things tried attach id star, this:

   `%i.fa.fa-star#example` 

if attach id else outside of .hamlc file, works.

but in file above, doesn't. have no clue if it's due fact it's backbone, etc. (i don't know backbone)

this jquery attached: (not jquery, ripped off online test it)

  $(document).ready(function() {      $("#example").popover({         placement: 'bottom',         html: 'true',         title : '<span class="text-info"><strong>title</strong></span>'+             '<button type="button" id="close" class="close" onclick="$(&quot;#example&quot;).popover(&quot;hide&quot;);">&times;</button>',     content : 'test'   }); });   

i know fact jquery works above since tried outside of first file.

but need attach popover star in file.

any advice?

edit

just clarify things, first file ... here file directory in case makes difference in troubleshooting why doesn't work in thisfile ...

app/assets/javascript/templates/messages.new.hamlc

and clarify, ruby on rails app backbone, , coffeescript in it.

hence file type being .hamlc ...

if should approach trying popover work on fontawesome icon in textbox in different way, please let me know. i'm @ wits end.

edit 2

i think has fact file has input textbox not receiving file has jquery in ...

the path of jquery file app/assets/javascript/template.js

and file in i'm trying call popover in stated above:

app/assets/javascript/templates/messages.new.hamlc

change code , should work.

... %i.fa.fa-star.pop ...  $(document).ready(function() {      $(".pop").popover({ .... 

edit: working, codepen


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -