Skip to content

Instantly share code, notes, and snippets.

@kikegarcia
Last active December 19, 2015 11:29
Show Gist options
  • Save kikegarcia/5947878 to your computer and use it in GitHub Desktop.
Save kikegarcia/5947878 to your computer and use it in GitHub Desktop.
Select and change A href (adds target blank too), Select Option & Img Src
// a href Selector and new attr
var linksToMondosonoro = $('a[href="/video/urltocatch"]');
$(linksToMondosonoro).attr("href", "http://www.newurl.com")
$(linksToMondosonoro).attr("target","_blank"); // añade un target blank
// Select Selector and new attr
var selectToMondosonoro = $('#selectmodifier option[value="/video/selecttocatch"]');
$(selectToMondosonoro).val('http://www.newurl.com');
// Img variable and the new property
var new_src = "/nueva/imagen.jpg";
$('img[src="/img/large/1.jpg"]').attr('src',new_src);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment