You need to insert javascript into the printf () function

printf("<script type='text/javascript'> $(function () { $('[data-toggle="tooltip"]').tooltip() }) </script>"); 

The problem occurs in line 3 with the tooltip. It is highlighted and actually does not work. enter image description here

Closed due to the fact that off-topic participants are Alexey Shimansky , user194374, pavel , Bald , Denis Bubnov 26 Dec '16 at 8:33 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Alexey Shimansky, Community Spirit, pavel, Bald, Denis Bubnov
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • who is printf ? and where did he come from in js? - Alexey Shimansky
  • You still do not answer? - Alexey Shimansky
  • 3
    See, you have unshielded quotes around the tooltip there, and in fact they make up two pairs with quotes inside brackets. Even in syntax highlighting it is noticeable. - Nick Volynkin
  • Is the function insertion problem solved? Now you can create a new question, in which you can already show what element you have on the page, what you want to do with it and what code you use to do this, in addition to the specified function. - AK
  • Please add code in the body of the question as text, not an image. To do this, use the " edit " link located under the question marks. - Nicolas Chabanovsky

2 answers 2

Screen quotes:

 printf("<script type='text/javascript'> $(function () { $('[data-toggle=\"tooltip\"]').tooltip() }) </script>"); 

Read more - in the PHP reference: http://php.net/manual/ru/language.types.string.php

For example, if you use single quotes and inside of them you need a single quote character, then:

To use a single quote within a string, escape it with a backslash ( \ )

Same thing with double quotes like yours.

  • Already tried - does not work. The problem means something else - FLWRZ4U
  • If you copy my code, then at least the syntax highlighting will show you that now your code is syntactically correct. A "not working" can for a variety of reasons. For example, you will not have such an element on the page. You may have a few mistakes, but you must fix this one, otherwise the rest will not even work. And what other errors - from your code is not clear, because too little code is given. It may be worthwhile to deal with other errors in a separate issue. - AK
 printf("<script type='text/javascript'> $(document).ready(function(){ $('[data-toggle=\"tooltip\"]').tooltip(); }); </script>");