Here I will show you the diffrent ways to Select which element you want
This is basicly just an Add-on to the First Jquery and SMF For Free Tutorial.
So, now to start.
[attribute] - Matches elements that have the specified attribute.
[attribute=value] - Matches elements that have the specified attribute with a certain value.
[attribute!=value] - Matches elements that don't have the specified attribute with a certain value.
[attribute^=value] - Matches elements that have the specified attribute and it starts with a certain value.
[attribute$=value] - Matches elements that have the specified attribute and it ends with a certain value.
[attribute*=value] - Matches elements that have the specified attribute and it contains a certain value.
[selector1][selector2][selectorN] - Matches elements that have the specified attribute and it contains a certain value.
In this tutorial, I will be using this as the example:
<table id='Table_1'>
<tr>
<td width='100%'>TD 1</td>
<td width='20%'>TD 2</td>
<td name='TD3' width='100%'>TD 3</td>
<td name='TheLongNameThatIsLong'>TD 4</td>
</tr>
</table>
[attribute] - Matches elements that have the specified attribute.<script>
$("table[width]").append("<b>Hey</b>");
</script>
That would append Text to the First, Seond, and Third TD.
[attribute=value] - Matches elements that don't have the specified attribute with a certain value.<script>
$("table[width='100%']").append("<b>Hey</b>");
</script>
That would append Text to the First and Third TD.
[attribute!=value] - Matches elements that don't have the specified attribute with a certain value.<script>
$("table[width!='100%']").append("<b>Hey</b>");
</script>
Would append Text to the Second, and Fourth TD.
[attribute^=value] - Matches elements that have the specified attribute and it starts with a certain value.<script>
$("table[width^='Long']").append("<b>Hey</b>");
</script>
Would append Text to the Fourth TD.
[attribute$=value] - Matches elements that have the specified attribute and it ends with a certain value.<script>
$("table[width$='Long']").append("<b>Hey</b>");
</script>
Would append Text to the Second, and Fourth TD.
[attribute*=value] - Matches elements that have the specified attribute and it contains a certain value.<script>
$("table[width*='0']").append("<b>Hey</b>");
</script>
Would append Text to the First, Second, and Third TD.
[selector1][selector2][selectorN] - Matches elements that have the specified attribute and it contains a certain value.<script>
$("table[width='100%'][name='TD3']").append("<b>Hey</b>");
</script>
That would only append text to the Third TD.
You can add as much attributes you want
Well, This tutorial is very basic. If you have any problems, just ask