I think it's a good rule to never ever use inline javascript in html like this.  Even with something like Knockout where it's idiomatic, you're referencing an attribute of the associated view model (and you should improve separation of concerns by hiding it behind `trackEditExpression()` or something.