0

This is my HTML

<td class="ms-formbody" vAlign="top">
   <!--  FieldName="BP number"
             FieldInternalName="BP_x0020_number"
             FieldType="SPFieldText"
           -->
</td>

Now I want a selector thar find the td that contains a value like this: FieldInternalName="BP_x0020_number"

I am trying this... but it is not working

$( 'td:contains( "FieldInternalName="BP_x0020_number"" )' );

What am I doing wrong?

Lugarini
  • 792
  • 5
  • 11
  • 32

1 Answers1

4

In your example you needed to escape your inner double-quotes (as you had quotes within quotes within quotes), but the main thing is to use a filter based on the HTML content (contains only looks at the text content for a string match):

JSFiddle: http://jsfiddle.net/3Ln92dv9/2/

$('td').filter(function(){
    return $(this).html().indexOf("FieldInternalName=\"BP_x0020_number\"") > 0;
});

You can just use single quotes in this format (no escaping needed):

$('td').filter(function(){
    return $(this).html().indexOf('FieldInternalName="BP_x0020_number"') > 0;
});
iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202