Javascript 移除可点击的div内按钮的锚定效果

Javascript 移除可点击的div内按钮的锚定效果,javascript,jquery,jquery-mobile,Javascript,Jquery,Jquery Mobile,我有一个完全可以点击的div。但现在我添加了一个按钮,点击后会出现一个弹出窗口。但我面临的问题是。当我点击信息按钮时,弹出窗口出现,但页面也会转到添加到最外层div的引用页面 我的html代码在这里 <div style="cursor:pointer; background:" onclick="location.href='http://inmotico.com';" class="contenido_anuncio"> Here if you click any whe

我有一个完全可以点击的div。但现在我添加了一个按钮,点击后会出现一个弹出窗口。但我面临的问题是。当我点击信息按钮时,弹出窗口出现,但页面也会转到添加到最外层div的引用页面

我的html代码在这里

<div style="cursor:pointer; background:" onclick="location.href='http://inmotico.com';" class="contenido_anuncio">
    Here if you click any where it will take you to the page
   <div style="font-size:14px;" class="anuncio_priceiimo">
<div style="margin-top: 0px; padding-left: 0px; margin-bottom: 0px;" class="ui-btn-inline">

    <div style="margin-top: 10px;" class="ui-block-a"> <a class="ui-link" style="color: #FF6600;"></a><a style="color: #FF6600;" class="ui-link">¢ 217,277,650.00</a></div>
<div class="ui-block-b">
    <a style="border:none !important;margin:0px 0px 0px 10px;" data-shadow="false" title="info" data-iconpos="notext" data-icon="info" data-role="button" href="#mDialog1" data-enhance="true" class=" ui-link ui-btn ui-icon-info ui-btn-icon-notext ui-corner-all" data-rel="popup" aria-haspopup="true" aria-owns="mDialog1" aria-expanded="false" role="button">INFO</a>
    </div>
</div>
</div>
</div>

在这里,如果你点击任何地方,它将带你进入页面

这里有一个**

首先,您需要学会在使用jQuery Mobile时不要使用内联javascript,这是一个很大的禁忌

工作示例:

HTML: 链接:
了解javascript和jQuery中的事件传播。基本上,在本例中,如果您以编程方式执行所有操作,则无需担心事件发生错误

但是我使用动态php代码来显示添加页面的细节。每个添加都有不同的链接,因此我将如何在vclick函数中添加它。我试过这样的东西。。。。它的作品在小提琴,但在我的网站上发生了错误,当我点击按钮,弹出窗口是不承认的功能。。。知道为什么会发生这种情况吗?让每个链接都有一个相同的标识符,比如class=“special link”或其他什么,并在我的示例中使用它。如果您看一下提供的JavaScript示例,它被称为委托事件绑定,它不关心元素exist或DOM中不存在的元素。一旦将具有给定标识符的元素添加到DOM中,vclick事件绑定就会对其起作用。对不起,兄弟,我不明白。我不知道在哪里添加Href:link then。像现在一样,它在div标记本身中,因此有尽可能多的链接,其数量等于页面中创建的div数量。我应该如何使用您的Javascript实现这一点?比如如何设置href我应该为href attr()添加一个侦听器吗??window.location.href=$(this.attr('href');你是说href链接打开弹出窗口?
<div style="cursor:pointer; background:"  class="contenido_anuncio" >
    Here if you click any where it will take you to the page
    <div style="font-size:14px;" class="anuncio_priceiimo">
        <div style="margin-top: 0px; padding-left: 0px; margin-bottom: 0px;" class="ui-btn-inline">

            <div style="margin-top: 10px;" class="ui-block-a">
                <a class="ui-link" style="color: #FF6600;"></a><a style="color: #FF6600;" class="ui-link">¢ 217,277,650.00</a>
            </div>
            <div class="ui-block-b">
                <a style="border:none !important;margin:0px 0px 0px 10px;" data-shadow="false" title="info" data-iconpos="notext" data-icon="info" data-role="button"  data-enhance="true" class=" ui-link ui-btn ui-icon-info ui-btn-icon-notext ui-corner-all" aria-haspopup="true" aria-owns="mDialog1" aria-expanded="false" role="button" id="info-btn">INFO</a>
            </div>



        </div>
    </div>
    <div data-role="popup" id="mDialog1" data-overlay-theme="a" data-theme="a" data-corners="true" data-dismissible="true">POPUP</div>

</div>
$(document).on('vclick', '#info-btn',function(event) {
    $('#mDialog1').popup('open');
    event.stopPropagation();
    event.stopImmediatePropagation();
});

$(document).on('vclick', '.contenido_anuncio',function(event) {
    location.href='http://inmotico.com';
    //alert('asdasd');
});