I do have a variable named “movieTitle”. I used it inside the click event, but how can I use the value of that variable when I use it inside a function that is outside the event?
function addMovie(){
$("Movie title is "+ movieTitle).appendTo("#output");
}
$("#insert").click(function(){
var movieTitle = $("input#movie").val();
addMovie();
})
Thank you.
Pass it as argument: