javascript - Appended anchor link is not active on Safari / iPhone -
i've got function, used lot of different parts of site calls confirmation box. when it's called formats box various elements , appends body, so...
$('body').append("<div id=\"confirmation\"><a href=\"javascript:confirmed()\">confirmed</a> <a href=\"javascript:closeconfirm()\">cancel</a></div>");
now, works accept iphone safari browser, doesn't seem activate, or load anchor dom properly... it not clickable. problem, tho box appears correctly, touching anchor nothing. console.log proves this.
any ideas?
have tried doing
$div = $('<div>', { id : "confirmation"}); $aconfirmed = $('<a>', { href : "#", class : "confirmed", text: "confirmed"}); $acancel = $('<a>', { href : "#", class : "cancel", text: "cancel"}); $div.append($aconfirmed).append($acancel); $('body').append($div);
and use event handlers (this assumes jquery > 1.7
$(document).on("click", "a.confirmed", function(){ confirmed(); }); $(document).on("click", "a.cancel", function(){ closeconfirm(); });
Comments
Post a Comment