# Web-item shows up later than at document ready

**URL:** <https://community.developer.atlassian.com/t/web-item-shows-up-later-than-at-document-ready/17491>\
**Category:** Jira Server\
**Tags:** jquery, javascript, web-item\
**Created:** [April 17, 2018, 12:56pm UTC](https://community.developer.atlassian.com/t/web-item-shows-up-later-than-at-document-ready/17491 "2018-04-17T12:56:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![otto.koivisto](https://avatars.discourse-cdn.com/v4/letter/o/848f3c/32.png) [@otto.koivisto](https://community.developer.atlassian.com/u/otto.koivisto)\
**Post date:** [April 17, 2018, 12:56pm UTC](https://community.developer.atlassian.com/t/web-item-shows-up-later-than-at-document-ready/17491/1 "2018-04-17T12:56:00Z")

</div>

So the issue I am having is when trying to bind a javascript function to a web-item, that I have placed in the “More” drop down menu under issue view, the web-item apparently does not exist yet. I am attempting the binding in AJS.$(document).ready. Right now I have a temporary solution that will simply try to set it again at 100 millisecond intervals until it succeeds or times out after a while. Needless to say this is not ideal and I would like to find a more permanent solution.

All of the code works, but the issue is simply time. Is there a better event to attempt the binding in?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/daniel/32/35798_2.png) [@daniel](https://community.developer.atlassian.com/u/daniel)\
**Post date:** [April 17, 2018, 2:05pm UTC](https://community.developer.atlassian.com/t/web-item-shows-up-later-than-at-document-ready/17491/2 "2018-04-17T14:05:04Z")

</div>

There are 2 ways of handling it:

- Use `AJS.$('###').live('click', function(evt){...});`
- Bind the the dropdown click first and then bind to your event after that.

The first way isn’t that great for performance if everyone is doing it. The second way can have a race condition.

---

<div class="post-metadata">

**Author:** ![otto.koivisto](https://avatars.discourse-cdn.com/v4/letter/o/848f3c/32.png) [@otto.koivisto](https://community.developer.atlassian.com/u/otto.koivisto)\
**Post date:** [April 18, 2018, 7:36am UTC](https://community.developer.atlassian.com/t/web-item-shows-up-later-than-at-document-ready/17491/3 "2018-04-18T07:36:26Z")

</div>

Thanks for the input. The feeling I am getting is there is no clean way to do what I want to do by JS functionality. I opted to go down the servlet route instead.
