Hiding / showing page parts based on form changes
I am new to jquery and am having a hard time figuring out this
problem.
I want to hide certain table rows containing form fields when a page
loads and only show them when the rel value in a select option equals
the rel value of the table row.
I'm using a non-standard attribute "rel" for this but could switch to id or class if it would be easier.
The first part is simple
$(function(){
$("tr[rel]").hide();
});
The rest I'm not sure about. I tried this:
$("select").change(function () {
$(("tr[rel]").val() == ("select").val()).("tr[rel]").show();
});
but nothing happened when the select fields were changed.
The other thing that I need to do is check the value of the select and radio
fields when the page loads and make sure that any
matching <tr> tags display.
Thanks in advance.