This project has moved and is read-only. For the latest updates, please go here.

Cannot get URL of a hyperlink column

Mar 3, 2012 at 1:03 AM

I have a simple custom list with a hyperlink column.  Under normal circumstances, I could get the URL as follows:

var url = ($(this).attr("ows_url")).split(",")[0];

However, this will fail if the URL is written like so:,123,3.html

Notice the comma in the URL? If I split this on the first comma then I will incorrectly receive the following:

How can I get the URL portion of a hyperlink column when the URL contains a comma?

Mar 3, 2012 at 1:36 AM

Found the answer.  The correct approach is to do the following:

var url = ($(this).attr("ows_url")).split(", ")[0];

It's hard to see but you should split on a comma AND a whitespace.