日期:2014-05-16  浏览次数:20441 次

嗯!求大神解答,关于jQuery的使用!困扰几个点了!
我现在正在做一个小项目,学校的那种,不是很正规。在使用jQuery进行前台设计的时候遇到了一些问题。代码:

$(document).ready(function () {
            $("#introduction").click(function () {
                var text = $(this).text();
                $(this).html("<textarea value'"+ text + "' id='txtIntroduction'></textarea>");
                $("#txtIntroduction").css("width", "550px").css("height", "300px")
            });
        });

功能描述:我希望在点击页面标签(ID为“introduction”)的时候能够内嵌一个输入框,并在输入之后将改变呈现在原来的页面上!

上面的代码有很多问题,仅仅作为说明,目的是让大家理解我的意图,求大神!!!
javascript jQuery WEB

------解决方案--------------------
<textarea>文字放在这</textarea>
------解决方案--------------------
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 <p title="A detail introduction about your conference" id="introduction">
            A smart thing can be endowed with different levels of intelligence, and may be context-aware, active, interactive, reactive</p>
<script>
    $(function () {

        $('#introduction').click(function () {
            $("#introduction").click(function (e) {
                if (e.target.tagName == 'TEXTAREA') return;
                var text = $(this).text();
                $(this).html("<textarea id='txtIntroduction'>" + text + "</textarea>");
                $("#txtIntroduction").css("width", "550px").css("height", "300px").blur(function () {