开发者

How can I parse jQuery variable that has the value of attr("title") back to HTML

开发者 https://www.devze.com 2023-02-15 10:45 出处:网络
I have got a variable called name here Name = $(this).attr(\"title\"); I need to parse this back to HTML, i.e.

I have got a variable called name here

Name = $(this).attr("title");

I need to parse this back to HTML, i.e.

N开发者_如何学JAVAudging <script>document.write (Name);</script>

But its not working, I think its something to do with scopes


Instead of:

Nudging <script>document.write (Name);</script>

Use something like:

Nudging <span id="someId"></span>

And this line of jQuery:

$("#someId").html(Name);

Check what exactly this is supposed to select in your expression. In the code at the URL you give, you could select like this:

Name = $(".alertdim").attr("title");

See the jQuery selectors reference here: http://api.jquery.com/category/selectors/

0

精彩评论

暂无评论...
验证码 换一张
取 消