Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery remove '/' from <img> tag?

Tags:

jquery

I have:

<img class="avatar_img" />

and after:

avatar_img.attr({src: "/site_media/avatars/" + this.userid + ".jpg", title: this.username});

I get:

<img title="admin" src="/site_media/avatars/1.jpg" class="avatar_img">

As you can see, slash "/" from end of tag has disappeard. How can I fix it? It seems to make some problem with render my site...

Doctype and others...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
like image 930
IProblemFactory Avatar asked Nov 22 '25 08:11

IProblemFactory


1 Answers

When viewing generated source, it doesn't necessarily follow the XHTML standards. The way the browser reads the DOM at runtime is different than how you see it in the XHTML code. How does this actually affect the rendering of your site? It shouldn't make a difference.

like image 73
Shawn Steward Avatar answered Nov 24 '25 00:11

Shawn Steward



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!