其實我的問題是不同的。如何在jQuery中調用onfocus事件的函數
我在下面這個小盒子裏調用了form中第一個元素的.focus事件的函數。
$(".tbox :input:visible:enabled:first").focus(function() {
tabIndexForm();
});
這是工作完美,但這是取代我自己的函數onFocus事件調用我手動設置的第一個元素的形式。這個怎麼做。我的形式是:
<form name="exampleform">
<input type="text" name="a" onfocus="somefunction();"/>
<input type="text" name="b"/>
</form>
現在,當我打開小框的tabIndexForm功能完美通話,但somefunction()不工作,因爲我覺得tabIndexForm替換該功能。如何更新下面的代碼以同時工作。
$(".tbox :input:visible:enabled:first").focus(function() {
tabIndexForm();
});
重要:我不能叫「somefunction()」中tinybox.js,因爲這是所有小盒子常見。
功能是正確的,可能你正在做一些其他的事情是錯的。使用開發工具和瀏覽器來查看它們。 – totten
確保你的函數可以訪問,並且如果可能的話在你定義它的地方顯示 – Adil