Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

hide "H6" tag

In the code below, if the following tag is selected:

<div id="ctl09_ctl08_divPostponedTaskGrid">


How do I hide the sibling above it?   ( the <h6> tag )



<table>
	<tbody><tr>
		<td><span>Completed by: Jaren Morris</span></td><td rowspan="4">

 <h6>Postponed Task</h6>
<div id="ctl09_ctl08_divPostponedTaskGrid">
    <div>

		</div>          
</div>

</td>
	</tr><tr>
		<td><span>Completed Date: 2/25/2013 11:27:23 AM</span></td>
	</tr><tr>
		<td><span>Assigned Role: Client Contact-L1</span></td>
	</tr><tr>
		<td><a href="ViewHTML.aspx?ApprovalQueueID=779111-1" target="Task History">Task View</a></td>
	</tr>
</tbody></table>

Open in new window

0
Tom Knowlton
Asked:
Tom Knowlton
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
basically this:
$('#ctl09_ctl08_divPostponedTaskGrid').select(function() {
  $('h6').hide();
});

Open in new window


however by the id i can tell that this is asp control, so the way to do it in jquery is:
 $('#<%= PostponedTaskGrid.ClientID %>').select(function() {
  $('h6').hide();
});

Open in new window

i used PostponedTaskGrid as the asp ctrl name, u should replace it with the real asp control which is rendered there.
0
 
Tom KnowltonWeb developerAuthor Commented:
Thank you.  I am sure that works.

My interim solution:


  $(document).ready(function () {

        $('div[id*="_divPostponedTaskGrid"]').each(function () {

            var tablecount = $(this).children('div').children().size();

            if (tablecount == 0) {               
                $(this).prevAll('h6').hide();
            }
            else {
                $(this).closest('#frame').css('background-image', 'none');
            }
        });

    });     

Open in new window




Was prevAll(  )  an okay choice?

It works - but was it correct?


Also, I am not familiar with select(  )

I thought these were the same thing:

 $('#<%= PostponedTaskGrid.ClientID %>').each(function() {
  $('h6').hide();
});


vs


 $('#<%= PostponedTaskGrid.ClientID %>').select(function() {
  $('h6').hide();
});
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now