最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap 3 Modal won't pop up when triggering from anchor tag - Stack Overflow

programmeradmin0浏览0评论

Looking at some video tutorials I follow what has been done but don't seem to get to modal of the register link to trigger.

Here is the link I want to trigger:

<li><a href="#register-modal" data-toggle="modal" data-target="#register-modal">Register</a></li>

Here is the modal that should be triggering

<!-- Register Modal -->
<div class="modal fade" id="#register-modal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h2>Register</h2>
            </div>
        </div>
    </div>
</div>

I assume that there should be jQuery to be implemented after looking at other answers but i do not see how e if the jQuery es from the bootstrap. The Bootstrap 3 documentation seems to do the same as I did

Looking at some video tutorials I follow what has been done but don't seem to get to modal of the register link to trigger.

Here is the link I want to trigger:

<li><a href="#register-modal" data-toggle="modal" data-target="#register-modal">Register</a></li>

Here is the modal that should be triggering

<!-- Register Modal -->
<div class="modal fade" id="#register-modal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h2>Register</h2>
            </div>
        </div>
    </div>
</div>

I assume that there should be jQuery to be implemented after looking at other answers but i do not see how e if the jQuery es from the bootstrap. The Bootstrap 3 documentation seems to do the same as I did http://getbootstrap./javascript/#modals-examples

Share Improve this question asked Mar 22, 2015 at 0:28 Beast_CodeBeast_Code 3,26714 gold badges44 silver badges54 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

The id attribute shouldn't have a hashtag.

Change

<div class="modal fade" id="#register-modal" role="dialog"></div>

to:

<div class="modal fade" id="register-modal" role="dialog"></div>

Working Example

发布评论

评论列表(0)

  1. 暂无评论