Knockout.js with jquery ui datepicker works everywhere except IE

前端 未结 2 2020
南旧
南旧 2021-01-20 17:16

I used a knockout.js templatescript to create a form that can be duplicated and deleted. The fiddle can be found here.

I editted the script with a litle help from SE

2条回答
  •  失恋的感觉
    2021-01-20 17:47

    2 things:

    like I said in the comments, use window.console.log (or a wrapper function) instead of console.log to prevent errors on older browsers who don't know the console object.

    I use this (and many others) to autocorrect a field. In this case uppercase the input. This works excellent on the first form. But not on any duplicate forms.

    replace:

    $(".hoofdletters").keyup(function(e) { $(".hoofdletters").val(($(".hoofdletters").val()).toUpperCase()); });
    

    with :

    $(".hoofdletters").on('keyup', '#', function(e) { $(".hoofdletters").val(($(".hoofdletters").val()).toUpperCase()); });
    

    that way you guarantee that future elements receive the keyup handler The root element is needed to limit the DOM monitoring scope for the on function. Ideally this would be a DIV element

提交回复
热议问题