Search code examples
javascriptjqueryhtmlrel

update attribute that is html


I have a anchor <a></a> with an attribute rel. in the rel value there is html, such as <a rel="html=<div>This is a test</div>. I want to update html inside of rel value, I can update the actual change on the page but if i go to the next slide and come back, its back to what it was before because the rel value is not updated. I am not sure how to go about doing this. Any suggestions, I am using Clearbox by the way.

Example(I know the html is incorrect on here, but it is correct on my page. I just need to know how to update it through jquery or any other way)

<a rel="html=<div class="testclass"> This is a test</div></a>

a piece of the html element (not the a) Needs to be changed to

<a rel="html=<div class="testclass"> No more testing </div></a>

Solution

  • You can (But SHOULDN'T) do that with

    this.rel = 'html=<div>But you shouldnt do that</div>';
    

    JSFiddle here