jQuery get html in div without any markup

I have some script written using the jQuery framework.

var site = {
link: $('#site-link').html()


This gets the html in the div site-link and assigns it to link. I later save link to the DB.

My issue is I don't want the html as I see this as being to dangerous, maybe?

I have tried:

 link: $('#site-link').val()

... but this just gives me a blank value.

How can I get the value inside the div without any markup?


Try doing this:


From the jQuery API Documentation:

Get the combined text contents of each element in the set of matched elements, including their descendants, or set the text contents of the matched elements.

Use the .text() jquery method like this:

    var site = {
        link: $('#site-link').text()

Here is an example of what .val(), .html() and .text() do: jsfiddle example

Need Your Help

Define app is routing app using google maps ios sdk

ios google-maps google-maps-sdk-ios

I'm trying to submit my app to the app store. I uploaded a geojson file to iTunes Connect because I provide directions via google maps directions API. I am now getting the following error while

How to get the difference in time in seconds?

c# .net datetime

In my C# code, I get the time using DateTime.Now, and again later. But now how can I get the difference between those two date objects in seconds as an integer value?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.