I want to have a line of code similar to below:
var name = $(\'#input-name\').attr(\"value\");
However, the id \'input-name\' is not guaran
var name; if ($('#input-name').length > 0) name= $('#input-name').attr("value");