Given this HTML:
<div class="blah" id="div1">a</div>
<div class="blah" id="div2">b</div>
I'm trying do make a handler depend on the value of "this", like in the following JavaScript code:
$(document).ready(function() {
$(".blah").click(function() {
alert(this.id); }); });
How to do it in Fay? I didn't find API to do this. It looks like it's impossible to call ffi directly from main:
main = ready $ do
select ".blah" >>= onClick (\_ ->
ffi "alert(this.id)")
I get "Test$ffi is not defined". I managed to call ffi using the code below:
alertthis = ffi "alert(this.id)"
main = ready $ do
select ".blah" >>= onClick (\_ ->
alertthis)
But now "this" refers to some Fay-specific object and doesn't have the property "id".