最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Event won't fire in event binding for "onblur" - Stack Overflow

programmeradmin0浏览0评论

I am trying to get some events to run using knockoutjs and for the life of me cannot figure this out. I've made a simple example to demonstrate the most basic idea of the syntax i am using with no success:

<input type="text" 
       data-bind="event: {onblur: function(){ alert('worked!') }}, 
                  value: signUpModel.fullName, 
                  valueUpdate: 'afterkeydown'" 
       maxlength="40" 
       id="inputFullName" />

Shouldn't this work?

I am trying to get some events to run using knockoutjs and for the life of me cannot figure this out. I've made a simple example to demonstrate the most basic idea of the syntax i am using with no success:

<input type="text" 
       data-bind="event: {onblur: function(){ alert('worked!') }}, 
                  value: signUpModel.fullName, 
                  valueUpdate: 'afterkeydown'" 
       maxlength="40" 
       id="inputFullName" />

Shouldn't this work?

Share Improve this question edited Feb 24, 2014 at 22:38 Jeroen 63.8k46 gold badges228 silver badges366 bronze badges asked Jul 27, 2011 at 18:36 billy jeanbilly jean 1,4294 gold badges27 silver badges46 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

You will want to just use blur instead of onblur. The framework handles it properly depending on whether is uses jQuery to attach the event or does it itself (no jQuery available).

发布评论

评论列表(0)

  1. 暂无评论