Is there any way i can change all links at once under option tag?
For Example:
<select size="1" name="links" onchange="window.location.href=this.value;">
<option value=" http://website.com/1001/">Blue</option>
</select><br>
<select size="1" name="links" onchange="window.location.href=this.value;">
<option value=" http://website.com/2001/">Red</option>
</select><br>
<select size="1" name="links" onchange="window.location.href=this.value;">
<option value=" http://website.com/3001/">Green</option>
</select>
.... And so on around 100 links .
Now i want to change link website.com to m.website.com furthur link remains same. Like m.website.com/1001 , m.website.com/1002
try this :
$(function(){
$('select[name="links"] option').each(function(){
var val=$(this).val();
val=val.replace('http://','http://m.');
$(this).val(val);
});
});
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With