jQuery UI button not working in IE
I have some jQuery UI buttons inside an tag
<div class="comprarnow">
<a href="http://buy-it.com.ar/product_info.php?manufacturers_id=&products_id=2&osCsid=f4ef2fde10273a05bab1076209809e80">
<span class="jqueryui">
<button id="tdb1" type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon ui-icon-cart"></span>
<span class="ui-button-text"> COMPRAR AHORA </span>
</button>
</span>
<script type="text/javascript">$("#tdb1").button({icons:{primary:"ui-icon-cart"}}).parent().removeClass("tdbLink");</script></a></div>
The buttons work and look great in all browsers except IE. The button is inside a simple tag which has its href value so I'm clueless on why if I click it, NOTHING happens, not even in the javascript error console, nothing...
Does anyone know why开发者_Python百科 this could be happening?
Thanks a lot
Is that the markup you're actually putting on your page, or the generated markup that you see after running the page? You're not supposed to use all the class="ui-*" stuff; that's supposed to be generated for you. Putting a button (and a script tag as well, I just noticed you put the </a></div>
at the very end of this code sample) inside an anchor is really odd as well -- jQuery UI is made for you to instantiate buttons on anchor or button or input elements with the same visual results... Why wouldn't you just do this?
<a id="tdb1" href="http://buy-it.com.ar/product_info.php?manufacturers_id=&products_id=2&osCsid=f4ef2fde10273a05bab1076209809e80">COMPRAR AHORA</a>
<script type="text/javascript">$("#tdb1").button({icons:{primary:"ui-icon-cart"}})</script>
- Make sure that you are importing the necessary jquery files
- Change:
$("#tdb1").button({icons:{primary:"ui-icon-cart"}}).parent().removeClass("tdbLink");
to
$(function() {
$("#tdb1").button({icons:{primary:"ui-icon-cart"}}).parent().removeClass("tdbLink");
});
精彩评论