Sunday, 15 April 2012

javascript - How to prevent click event over the whole span with children? -



javascript - How to prevent click event over the whole span with children? -

how prevent triggering calendar, not clicking on icon on whole tag? in case if i'm trying straight without children selector it's doesn't working.

my implementation

html:

<div id="datetimepicker1" class="input-append date"> <input type="text" disabled="true"></input> <span class="add-on disabled"> <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i> </span> </div>

js:

$(function () { $('#datetimepicker1').datetimepicker(); $(".disabled").children().bind('click', function () { homecoming false; }); });

edit : http://jsfiddle.net/vg4xa/1/

you have set event handler before datepicker init, , stop event propagation :

$(function () { $('.disabled').bind('click', function(e){ e.stopimmediatepropagation(); }); $('#datetimepicker1').datetimepicker(); });

javascript jquery twitter-bootstrap

No comments:

Post a Comment