Is it possible to perform a "prepend" on an attribute?

Asked

Viewed 22 times

1

I have the following situation: When I make the request from my bank, my tags <img> comes with the attribute src filled, is it possible for me to perform a prepend in the same?

For example: <img src="meuArquivo.jpg">, and via jQuery I enter the path before the "myfile.jpg"?

I understand it as something like this:

var meuCaminho = "C:/"
$('img').attr('src').prepend(meuCaminho);

But I don’t think it’s functional.

  • I don’t understand. First, the src image can’t be that way. And second, put an example of how you want it to stay your img.

  • edited the question, take a look

1 answer

2


You don’t have to use prepend.

var imagem = $('img').attr('src');
var meuCaminho = "C:/"

$('img').attr('src', meuCaminho + imagem);
  • worked, thank you for your attention

Browser other questions tagged

You are not signed in. Login or sign up in order to post.