Does 'this' refer to the element that called this function?

前端 未结 2 671
北海茫月
北海茫月 2021-01-21 11:07

In the snippet below I use $(this) to refer to the element in which the function is being called from. I know it is not correct because I printed out the values an

2条回答
  •  时光取名叫无心
    2021-01-21 11:41

    That's what the obj parameter is for in the onSelect function, so you'd reference $(obj). Just for reference, this will refer to the associated input field.

    For reference, see: http://jqueryui.com/demos/datepicker/ > Events > onSelect

提交回复
热议问题