是否可以开发基于Web的应用程序,而JS文件中没有任何HTML和CSS代码?

时间:2019-06-26 10:29:45

标签: javascript jquery html css handlebars.js

我正在开发一个类似于电子商务网站的基于Web的应用程序。客户的期望是我们不应该在javascript文件内使用任何HTML和CSS代码(即,html应该是html文件样式,应该是样式文件,而js应该是js文件。有可能吗?

我们使用把手来避免html,并添加类并删除类以避免css。

<div id="country" class="dropdown">
  <button type="button" class="dropdown-toggle text-left accountEditValidation w-100 custom-dropdown primary-color" id="countryButton" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false">
    Select One..
    <i class="float-right fal fa-angle-down"></i>
  </button>
  <input type="hidden" name="selectedCountry" id="selectedCountry" value="China">
  <div class="dropdown-menu m-0 custom-dropdown-menu border-top-0 rounded-0 w-100">
    <a class="dropdown-item" href="#">America
      <i class="pl-3 fal fa-check d-none"></i>
    </a>
    <a class="dropdown-item" href="#">Asia
      <i class="pl-3 fal fa-check d-none"></i>
    </a>
    <a class="dropdown-item" href="#">Europe
      <i class="pl-3 fal fa-check d-none"></i>
    </a>
  </div>
</div>
$('#accountEdit #country').on('hide.bs.dropdown', toggleCountryPopUpEditIcon);
$('#accountEdit #country').on('show.bs.dropdown', toggleCountryPopUpEditIcon);
$("#accountEdit #country .dropdown-menu").on('click', 'a', function() {
  event.preventDefault();
  $("#accountEdit #selectedCountry").val($(this).text());
  $("#accountEdit #countryButton").html($(this).text() + '  <
    i class = "float-right fal fa-angle-up" > ');
    $("#accountEdit #countryButton").addClass("primary-color"); $(this).siblings().find("i").removeClass("d-inline-block"); $(this).find("i").addClass("d-inline-block");
  });

这里是在选择必须更新值的项目时使用引导程序4下拉列表,而不是选择一个...。在下拉菜单中,打开值应选择一个... id,如果用户未选择,请选择需要更新值的任何值不要选择任何值以前选择的值需要更新。 在更新整个对接html内容而更新时,这里无法仅更新文本,因此图标将消失,因此使用标签内的icon进行更新。这必须删除。

0 个答案:

没有答案