jquery-encoder icon indicating copy to clipboard operation
jquery-encoder copied to clipboard

encodeForHTMLAttribute

Open ricmetal opened this issue 11 years ago • 1 comments

is there any problem with reverting the order of apostrophes:

title= ' " + $.encoder.encodeForHTMLAttribute(var) + " ' and title= " ' + $.encoder.encodeForHTMLAttribute(var) + ' "

do they work interchangeably? i thought i saw the example with a different apostrophe order than the one i am using - in my case the order i have doesn't seem to work. the data being treated isnt even printed. it actually seems to break the line of code it is in, which is a simple elemnt creation, with the img's default attributes, src, alt and title.

using encodeForHTML allows the data to be printed, but the data is not treated correctly, as the single apostrophe in the data closes the attribute...

here is the code, ive interchanged the apostrophes but the result (fail) is the same..i dont know why. is the img title attribute not an attribute?

var imgBoxes = '';
                    for(var n = 0; n < items; n++){
                        imgBoxes += '<div id="imgBox' + parentArray[n][0] + '" class="image-box image-box-unselected"><img src="gallery/' + userId + '/exhibitions/' + parentArray[n][1] + '" title="" alt="' + ls_glob_img_alt + '"><div class="photo-icons"><img src="' + ls_glob_del_src + '" onclick="delPic_confirm(\'' + parentArray[n][0] + '\', \'manage\'); this.blur();" class="pointer del-photo-icon invisible ttip" alt="' + ls_glob_del_txt + '" title="' + $.encoder.encodeForHTMLAttribute(ls_glob_dpb_title) + '"> <img src="' + ls_glob_edit_src + '" id="epi' + parentArray[n][0] + '" class="pointer edit-photo-icon invisible ttip" alt="' + ls_glob_epd_title + '" title="' + ls_glob_edit_at + '"></div></div>';
                    }
                    $('#galleryScroller_div').append(imgBoxes);

ricmetal avatar Sep 02 '13 20:09 ricmetal

@ricmetal - I am working on resurrecting this project a little, and going through these old issues. Can you confirm that this is still an open issue for you?

chrisisbeef avatar Dec 11 '15 21:12 chrisisbeef