I FORMULATED MY SELF VERY BADLY!
我将首先谈谈: 我赞赏你的好回答,如果你能够,我会努力回答这一点:(此时我将更具体地谈一下)。
我想的是:<form>
element onsubmit, onclick of a hton or what take the Value of a <input category=“text” Value=“Default Value”>
,并插入一 couple<span>
elements,我叫“持有人”。 这一样本可能更能说明:
<head>
<script type="text/javascript">
$(document).ready(function()
{
$("input[type=button]").click(function //click the button
{ do_the_magic_thing() //make the value from id="txt_inp" appear in class="placeholder"
});
});
</script>
</head>
<body>
<form method="POST" action="" id="theForm"> //could also be get, I don t care
<input type="text" id="txt_inp" value="Default Value" onfocus="if (this.value == Default Value) this.value= "> //this SHOULD make the Default Value dissapear on focus
<input type="button"> //could also be a submit
<span class="placeholder"></span> //$("#txt_inp").value; goes here
<span class="placeholder"></span> //$("#txt_inp").value; goes here
</body>
现在,这是否真的简单:
var do_the_magic_thing = function() {
$(".placeholder").html = $("#txt_inp").value;
};
我现在要问一下——在丹麦晚了: 我明天将回答你的意见:
OLD POST:
I am very new to this jQuery thing, but I do understand the basics and all. Let s simplify and say I have a form which looks like this:
<form method="POST" action="">
<input type="text" value="Default value">
<input type="submit" value="Click me">
<input type="hidden"> //hidden is for being able to submit by hitting enter
</form>
我用<代码>$.post进行了尝试,但我不能这样做;我不为我工作。
现在,我要取消提交文件(如果存在的话,仅添加“<代码>return不实;在返还价值的职能中这样做),但这并非关键。
我认为,我喜欢这样作。
$.post("test.php", function(data) {
alert("This is the data submitted (and cancelled):" + data);
}); //I have also tried without the "test.php", that s not it
你们能够告诉我,我是谁错了?
NOTE
It is not necessary, that the submit is cancelled, but I would like that
Nor is it necessary, that POST is the method used, but once again, this is what I prefer