javascript - Issue with CSS display property -
i need show remove button when edit button clicked , in normal cases don't want show it.
in normal case, remove button not showing up, when go , place/hover mouse on position remove button placed , click it(here cant see remove button), functionality happening happen when button clicked.
when want show remove button,
<?php if($something){ ?> <i class="fa fa-times-circle remove" style="margin-left: 5px; margin-top: 5px;" onclick="function('parameter')"></i> <?php } ?>
when don't want show button,
<?php if($someotherthing){ ?> <i class="fa fa-times-circle remove" style="margin-left: 5px; margin-top: 5px;display: none" onclick="function('parameter')"></i> <?php } ?>
and javascript code when edit button clicked,
$('.remove').css('display', 'inline');
just assign , remove click handler using jquery. it's cleaner having in html anyway.
so when edit button clicked, you'll have:
$('.remove').css('display', 'inline'); $('.remove').on('click', function () { // code here });
and when remove button should hide:
$('.remove').css('display', 'none'); $('.remove').off('click');
Comments
Post a Comment