It's from a java script lesson i'm learning in codecademy.
It works in console.log when i define the var name="";
I would like to incorporate it into a simple form with a field name and a Submit button.
But I'm just not getting the prompt/alert with the name i put in the form.
So here is the HTML markup:
<form>
<div>
enterName
</div>
<input name="enterName" id="enterName" type="text">
</form>
<div style="margin-top:10px;" class="submit"><input value="submit" size="18" id="submit_this" type="button"></div>
And the script:
<script>
$(document).ready(function() {
var greeting=function(name){
var name=$('#enterName').text();
console.log('Great to see you,' + '' + name);
};
greeting();
$('#Result').text(name);
$('#submit_this').click(function(){
greeting();
prompt('Great to see you,' + '' + name);
});
});
</script>