代码之家  ›  专栏  ›  技术社区  ›  van

类中的jquery select链接包含文本

  •  0
  • van  · 技术社区  · 16 年前

    我有下面的html:

    <span class="srch-URL">
    <a id="CSR_U_2" href="http://www.test.com/TestForm.aspx">http://www.test.com/TestForm.aspx</a>
    </span>
    

    $('a[href*="TestForm.aspx"]')
    

    但我只需要为类'srch URL'中包含的if执行此操作,然后附加;源参数。。。

    1 回复  |  直到 16 年前
        1
  •  1
  •   hookedonwinter    16 年前

    尝试:

    $( 'span.srch-URL a[href*="TestForm.aspx"]' )
    

    如果您不确定如何更改url,请尝试:

    $( 'span.srch-URL a[href*="TestForm.aspx"]' ).each(function(){
        $( this ).attr( 'href', $( this ).attr('href') + '&Source=/default.aspx' )
    });