Jump to content

JQuery has not issue


Joss
 Share

Recommended Posts

Hi there JQuery shaped people!
 

I need to prepend something to an element on the page list, but because of the way it is working, I need to check whether it has already been prepended!

So This is what I am starting with:

<li class="PageListActionEdit">

<a href="/siteadmin/page/edit/?id=1">Edit</a>

</li>

And I need to end up with

<li class="PageListActionEdit">
<a href="/siteadmin/page/edit/?id=1"><i class="icon-edit"></i>Edit</a>
</li>

Since this is part of the ajaxified page list, I can't simply do this:

$('.PageListActionEdit a').prepend(' <i class="icon-edit"></i> ');

Because it will just add another one on every time I click a page.

I assume this is probably using either .not() or .has()  to make sure a particular version has the Icon, and if so, doesn't prepend it, but I cant get it working!

Help!

Joss

Link to comment
Share on other sites

Hi Diogo - I thought you had gone home!
 

All that does is print <i class="icon-edit"></i> (As in you can actually see it) and replace the "Edit", though at least it does not duplicate itself all over the place :)

I have just tried html instead, and that is better, but I need to rescue the original text

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...