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

DOM manipulation - get string, trim by remove space, comma and combined it as URL

0 votes
3 views
added Mar 30 in jQuery by LC Marshal Second Warrant Officer (6,690 points)
edited Mar 30 by LC Marshal
var areaname = $('h1.page-header').text();
var lookforstate = $('ol.breadcrumb li:last-child').text();
var trimstate = lookforstate.split(",");
var resultstate  = trimstate [trimstate.length-1];
var getstate = $.trim(resultstate);
var w = "/map-search-property?&state=";
var x = "&district="; 

var result = w + getstate + x + areaname;
$('a#search-listing-area').attr('href', result);

Please log in or register to example this solution.

lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...