Append <a href> with some string and "alt" of the child image
I have been trying to accomplish something.
For every a tag enclosing an images,
I am trying to append some strings along with the 'alt' attribute of the image to the end of <a> tag's href attribute based on the condition that,
if a:contains('?') then it will appended with "&text"
else , append with "?text"
my script goes like this,
var baoBao = $('a').children('img').attr('alt');
var noQ = '?text' + baoBao;
var yesQ = '&text' + baoBao;
this.href += noQ;
this.href += yesQ;
Presently it does not work,
Can some one please help me.