I have this coffeescript code
greet = ->
if $('#output').html() is 'Hi' and $('#textName').val() is not ""
$("#output").append(" how are you #{$('#textName').val()}?")
The second condition is the value of an HTML input. If I quit the second condition the script work but if I put it (as in the code above) the script doesn't work no matter what.
I tested the value of the input through some alert commands and the value is actualized so the problem is not the value itself if not about how the boolean or the function works, by example if I enter in the input something like "Markus" and run this code
greet = ->
if $('#output').html() is 'Hi' and $('#textName').val() is not ""
$("#output").append(" how are you #{$('#textName').val()}?")
alert $('#textName').val()
The alert shows "Markus" but the function still doesn't work, the .append fail to add text to a div. The HTML involved is something like this
<body>
<form>
<fieldset>
<input placeholder="Put your name" id="textName" type="text">
</fieldset>
</form>
<div id="parent">
<div id="output" onmouseover="greet()">Hi</div>
</div>
</body>
Can you help me please? Thank you in advance.
P.S.: I verified the correctness of the coffeescript code in the compiled javascript. I used parenthesis to encapsulate both boolean conditions too but doesn't work either.