javascript - Call a function from a html added with html() function -


i have function javascript file :

function toggle_concessions(concessions) {      var text =               "<table>"+             "<tr><td class='concession-name'>gfhgfbfghfd</td><td class='op-encours'>| 15 opérations en cours</td></tr>"+             "<tr class='stats'><td class='concession-adresse'>ghfhdfhdgh</td><td class='voir-concessions'><img id='11' src='img/voirlesoperations.jpg' onclick='toggle_operations('ffff');'></td></tr>"+             "</table>";             ;      if($("#"+concessions).attr("class")!="concessions toggled"){         $("#"+concessions).html(text);         $("#"+concessions).toggleclass("toggled");                }else{         $("#"+concessions).toggleclass("");     }      $("#"+concessions).toggle("slow"); } 

the function "toggle_operations()" isn't working when click on image. when execute alert doesn't work.

what can ?

thanks

your html-embedded js not formed due wrong pairing of string delimiters - have escape quotes surrounding argument toggle_operations call:

"<tr class='stats'><td class='concession-adresse'>ghfhdfhdgh</td><td class='voir-concessions'><img id='11' src='img/voirlesoperations.jpg' onclick='toggle_operations(\'ffff\');'></td></tr>"+ 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -