How do I adapt this jQuery .prop()
to return mutiple href
results?
window.onload = function() {
var val = jQuery(".ro_title").prop("href");
jQuery("#form-field-name").val(val);
How do I adapt this jQuery .prop()
to return mutiple href
results?
window.onload = function() {
var val = jQuery(".ro_title").prop("href");
jQuery("#form-field-name").val(val);
2
Answers
With a
each
loop. Through each element containing the.ro_title
CSS class, concat thehref
property to theval
variable like this:You are probably looking for a combination of
.map()
and.toArray()
: