javascriptjqueryajaxjquery-eventssubmission

Where is the event listener for submission the form?


A twitter-like website in Chinese. When I type a message and click a submit "button", a new entry is created. But I can't figure out the event listener for the submit "button".

I studied the source code, there is no form at all, and the "button" is actually an <a href="javascript:;" class="sendinfo-btn submit-trigger" title="按Ctrl+Enter键发微博">发布</a> element.

So I think the website is using ajax to do the actual submission. I use google chrome to inspect the submit "button", but there is no event listener at all! So how could the submission be done?

Here is some relevant html code:

<div class="publishBox-ft clearfix">
    <div class="fl">
        <div class="uploadPic">
            <em class="icon-uploadPic"></em>
            <a class="link-lb js-link">图片</a>
        </div>
        <div class="insertFace">
            <em class="icon-face"></em>
            <a class="link-lb js-link">表情</a>
        </div>
        <div class="topic-trigger">
            <em class="icon-topic"></em>
            <a class="link-lb js-link">话题</a>
        </div>
        <div class="insertVideo video-trigger">
            <em class="icon-video"></em>
            <a class="link-lb js-link">视频</a>
        </div>
        <div class="insertPoi">
            <em class="icon-lbsB"></em>
            <span class="sendinfo-lbsbox link-lb">
                <span class="sendinfo-showPoi">
                    <a class="sendinfo-currentPoi sendinfo-changePoi js-link poi-trigger" data-poi-id="null" data-poiname="发布地点">地点</a>
                    <a title="删除位置信息" class="js-link sendinfo-closePoi default-close-icon"></a>
                </span>
            </span>
        </div>
    </div>
    <div class="fr">
        <a href="javascript:;" class="sendinfo-btn submit-trigger" title="按Ctrl+Enter键发微博">发布</a>
        <span class="js-wordCounter word-counter sendinfoTip">还可以输<span class="char-constantia">152</span>字</span>
    </div>
</div>

If somebody want to go the acutal website to study, here is the url and username and password: http://t.163.com/4729009840
username: fatieji_test@163.com
password: 1a2b3c4d

Be aware: the website is in Chinese.


Solution

  • The click event is bound at runtime in the JavaScript file.

    The relevant parts to search for are t.sendBtnElem=$(t.wrapperElem.$(".sendinfo-btn")[0]) and t.sendBtnElem.addEvent("click", ...