jquery - 在动态生成的列表中选择列表元素

标签 jquery list selection element

 <div id="carat_weight_right" style="margin-top: 15px;float:left;width:444px;border-width:1px 0px 1px 0 ;border-style:solid; border-color:#327B84;padding-top:10px;padding-bottom:33px;*padding-bottom:59px;">

 <fieldset style="padding-left:20px;padding-bottom:10px;width:415px;margin-top:3px;font-size;10px;">

   <--- start auto gen  using js / java third party tool for sliders using the filament slider tool ---->
  <ol class="ui-slider-scale ui-helper-reset" role="presentation">
  <li style="left:0.00%"><span class="ui-slider-label ui-slider-label-show" style="margin-left: -11.5px; ">FAIR</span><span class="ui-slider-tic ui-widget-content" style="display: none;"></span></li>
  <li style="left:25.00%"><span class="ui-slider-label ui-slider-label-show" style="margin-left: -15.5px; ">GOOD</span><span class="ui-slider-tic ui-widget-content"></span></li>
  <li style="left:50.00%"><span class="ui-slider-label ui-slider-label-show" style="margin-left: -15.5px; ">VERY GOOD</span><span class="ui-slider-tic ui-widget-content"></span></li>
  <li style="left:75.00%"><span class="ui-slider-label ui-slider-label-show" style="margin-left: -15px; ">IDEAL</span><span class="ui-slider-tic ui-widget-content"></span></li>
  <li style="left:100.00%"><span class="ui-slider-label ui-slider-label-show" style="margin-left: -30px; ">SIGNATURE IDEAL</span><span class="ui-slider-tic ui-widget-content" style="display: none;"></span></li></ol>


  <--- end auto genereted list ---->

  </fieldset>
  </div>

我想要做的是能够选择这个 < li style="left:100.00%"> 并更改上面的 < li style="left:100.00%"> 中的跨度样式?

如何使用 jquery 在

  • 中选择特定的 < li style="left:100.00%"> 和跨度?

    谢谢

  • 最佳答案

    CSS 截断小数点。

    $('li').css('left', function(index, value) {
        if (value === '100%') {
            $(this).children('span').css(''); //Do what you wish here
        }
    });
    

    关于jquery - 在动态生成的列表中选择列表元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5940473/

    相关文章:

    Python:仅将 csv 文件中的一些属性提取到 numpy 数组

    select - swt 表更改选择项颜色

    javascript - 将选中的项目推到列表顶部

    javascript - 我如何通过 javascript 为 css 代码运行这篇文章

    python - 将此列表拆分为更小列表的最佳方法?

    visual-studio-2010 - 调试器友好列表类

    javascript - jQuery - 从文本区域中选择所有文本

    javascript - 如何在 JQuery DataTable 上动态创建 Bootstrap Popover

    javascript - 我可以将 jQuery.post() 与 LiveServerTestCase 一起使用吗?

    python - 将每个列表的元素与列表中的其他元素进行比较