Are you first timer at lazacode.org? Why not join us and start exchange your knowledge with everyone. Register today!

jQuery .attr() method

0 votes
3 views
added Apr 2 in jQuery by LC Marshal Second Warrant Officer (6,690 points)

Find element and change the href value

$(".button a").attr("href", "http://www.hormart.com/")

2 examples

0 votes
responded Apr 3 by LC Marshal Second Warrant Officer (6,690 points)

To change breadcrumb link no.3 to use PHP variable to replace the existing link

var lookfordistrict = $('ol.breadcrumb li:nth-child(3) a'); 
var districtlink = "/map-search-property?listing_type=<?php print $field_prop_listing_type; ?>&state=<?php print $field_state; ?>&district=<?php print $field_district; ?>";
$(lookfordistrict).attr('href', districtlink);
0 votes
responded Apr 10 by LC Marshal Second Warrant Officer (6,690 points)

Add id attribute to element

$(detailcontent).attr('id', 'property-detail-content'); 
lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...