更新 html 属性

发布于 2024-12-18 20:37:05 字数 617 浏览 5 评论 0 原文

我有一个带有属性 rel 的锚点 。 rel值中有html,例如Clearbox 顺便说一下

示例(我知道这里的 html 不正确,但在我的页面上是正确的)我只需要知道如何通过jquery或任何其他方式更新它)

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

一块html元素(而不是a)需要更改为

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

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

作业与我同在 2024-12-25 20:37:05

您可以(但不应该)使用

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

JSFiddle 此处执行此操作

You can (But SHOULDN'T) do that with

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

JSFiddle here

智商已欠费 2024-12-25 20:37:05

我认为您需要避免在另一个双引号内使用双引号,如果您使用双引号来包裹字符串,请在该字符串内使用单引号,反之亦然。

看到这个--> http://jsfiddle.net/Galled/rXKCL/14/

I think you need to avoid the use of double quotes inside another double quotes, if you are using double quotes to wrap a string use single quotes inside that string and vice versa.

See this --> http://jsfiddle.net/Galled/rXKCL/14/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文