Passing parameter in a function inside string

Tag: function , variables , parameters Author: xxiinn202 Date: 2013-10-14

Please, I need a help... my function is not working, there is my code:

    var tel=99, nome='c';

     $('#listaCont').append("<li class='list-item-single-line selectable'><a href='#' onclick='pegarContactos( tel, nome)'> <h3>Célio Garcia</h3></a></li>");

and my function:

function pegarContactos (tel, nome){
        tel, nome,


Uncaught ReferenceError: pegarContactos is not defined

where is the wrong ????

Javascript? You should tag the language to make it clear...
Probably scope. Don't add onclick attributes with JS. You're using jQuery. Bind your event handlers with .on().
@Quentin... can give me your solution in code?