Are you first timer at 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
added Mar 30 in jQuery by LC Marshal Second Warrant Officer (6,690 points)
edited Mar 30 by LC Marshal
var areaname = $('').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. - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.