English 中文(简体)
a. 填满与html的 d[复制]
原标题:populating a div with html with query [duplicate]
  • 时间:2012-05-10 09:44:50
  •  标签:
  • jquery
  • html
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
how to get the value of a textarea in jquery?

我有以下超文本:

<div id="textdescription"></div>

以及以下 j(从形式文本中获取价值):

var description = $( #inputDescription ).html();
$( #textdescription ).html(description);

我怎么能够把价值变成说明

最佳回答

val(: val()方法主要用来获取投入、选择和文本领域等形式要素的数值。

html(): 一组对应内容中的第一个要素的超文本内容。

text(: 2. 找到包括后代在内的一组相应要素的综合内容。

   var description = $( #inputDescription ).val();
     $( #textdescription ).html(description);

见http://jsfiddle.net/tAXYg/“rel=”nofollow。 JsFiddle Demo

问题回答

你们必须使用

$( #inputDescription ).val();

供投入(包括案文领域a)项而不是<代码>.html()

http://jsfiddle.net/welcse06/Gbt9L/“rel=“nofollow”

$("#description").val("something you want to put");




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签