- Screen name: randeveloper
randeveloper's Profile
2 Posts
1 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 15-Dec-2011 11:22 PM
- Forum: Using jQuery
Here is the scenario I am having trouble with.
I have a breadcrumb navigation menu that is dynamically generated but
I can add my own JS to the bottom of the page to affect it with
jQuery. I have tried to simplify the code below as much as possible.<td class="bc_cell">
<img class="my_icon" alt="my_icon" title="my_icon" src="trans.gif">
<a class="bc_anchor" title="first_bc" href="#">First breadcrumb link</a>
|
<a class="bc_anchor" href="#" title="second_bc">random link one</a>
|
<span class="bc_final">Last bit of breadcrumb</span>
</td>
If the page detects that the <a> tag has the text "random link one"
that it does the following.
Insert a class called .red_icon into (.bc_cell .my_icon) so it was
left looking like this.
<img class="my_icon red_icon" alt="my_icon" title="my_icon" src="trans.gif">or if that's not possible to do then
$j('<style>.bc_cell .my_icon { background: red;
}</style>').insertAfter('.my_icon');The part I can't figure out is how to sense for the text.
I will have 6 different instances of text to sense and put different
classes for each.
For example
if it finds "random link two" then put a class of .blue_icon into
(.bc_cell .my_icon)
etc.I anticipate putting this near the bottom of the page close to </body>Thanks for any help you can provide.- I have a situation where I cannot change a site's dynamically generated code but I can add HTML/JS to it with jQuery. I have a three table cells in a row. I want to take the third cell and put it on a new <tr>
The example code below illustrates what I am trying to do. The problem with using this$("</tr><tr class='row_two'><td class='new_cell'> </td>").insertBefore(".third");is that it makes a new <tr> but it closes that immediately instead of absorbing the <td> below it. Any advice would be great.<table><tr class="row_one">
<td class="first">First Cell</td>
<td class="second">Second Cell</td>
<td class="third">Third Cell</td></tr>
</table>---I want it to turn into this----<table><tr class="row_one"><td class="first">First Cell</td>
<td class="second">Second Cell</td></tr><tr class="row_two"><td class="new_cell"> </td>
<td class="third">Third Cell</td></tr></table>- «Prev
- Next »
Moderate user : randeveloper