Adding a string inside a node of an XML object using JavaScript or jQuery -
this first time doing xml. i'm working script (i'm not original author) outputs xml object so:
var myurl = <ajaxxmlobject><textarea>"http://examplewebsite.com/?page=home¶metera=x¶meterb=y"</textarea></ajaxxmlobject>
is there way, using jquery or javascript, of accessing <textarea>
node , concatenating string url? far research has come short.
you can wrap xml in jquery object reference/update node text.
var myobj = $('<ajaxxmlobject><textarea>"http://examplewebsite.com/?page=home¶metera=x¶meterb=y"</textarea></ajaxxmlobject>'); var url = myobj.find('textarea').text().replace('"', '').replace('"', ''); url += "&some=stuff"; myobj.find('textarea').text('"' + url + '"') alert(myobj.find('textarea').text());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
i added handling maintain double quotes. not sure if need or not.
Comments
Post a Comment