js脚本仅在存在警报时才起作用

编程入门 行业动态 更新时间:2024-10-10 06:21:39
本文介绍了js脚本仅在存在警报时才起作用-而不是ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

OnClick事件调用以下datepicker函数.如果存在警报,则可以正常工作.否则,它不会显示所需的压光机.这是时间问题吗?

An OnClick event calls the following datepicker function. If an alert is present then, it works fine. Otherwise, it does not show the calender as required. Is this a timing issue?

function changeStartDate(Item){ alert ("alert goes here"); $("#datepicker_" + Item).datepicker({ dateFormat: 'M-dd-yy', onClose: function(dataText, inst){ newDate = dataText; processDateChange(newDate); }, }); flag = 1; }

从何处调用

'<div class="InfoBoxLong" id="StartDate_' + TransactionOrderItemID + '"><input id="datepicker_' + TransactionOrderItemID + '" type="text" size="9" id="StartDate_' + TransactionOrderItemID + '" onClick="changeStartDate(\'' + TransactionOrderItemID + '\')" value="' + ActivationStartDate + '"> </input></div>' +

推荐答案

可能日历日历DOM尚未完成渲染-添加alert()会阻塞页面,使该页面有时间完成渲染.使用等效的jquery.ready( docs.jquery/Events/ready# fn )呈现日历,然后仅在onclick事件上显示日历(而不是呈现日历).

Possible the calender DOM hasn't finished rendering - adding an alert() blocks the page which gives it time to finish rendering. Use the equivalent of jquery.ready (docs.jquery/Events/ready#fn) to render the calender and then only show it (rather than rendering it) on the onclick event.

更多推荐

js脚本仅在存在警报时才起作用

本文发布于:2023-11-27 21:20:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639646.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   时才   脚本   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!