i want to get only the parse value of the html field here's my html.
<tr valign="baseline">
<td nowrap align="left"><label>data:</label></td>
<td><input type="text" name="data" id="data" size="32" value=""></td>
</tr>
and here's my jquery inside onclick function.
data =$("#try").html();
$("#data").val(data);
console.log("error");
and here's the result that display in the field
<p class="1">1</p><p class="2">2</p><p class="3">3</p>
i want to get only the value of P. its like 123 using php hope anyone can help me as soon as possible. thanks in advance.
your description is a little confusing. But if I got it right you end up with a string like
<p class="1">1</p><p class="2">2</p><p class="3">3</p>
And you have to filter that string in PHP, not in JS.
If so, just use strip_tags
echo strip_tags('<p class="1">1</p><p class="2">2</p><p class="3">3</p>');
Hope that is what you are looking for
Regards,
Stefan
var data = $("#try p").text();
$("#data").val(data);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr valign="baseline">
<td nowrap align="left">
<label>data:</label>
</td>
<td>
<input type="text" name="data" id="data" size="32" value="">
</td>
</tr>
</table>
<div id="try">
<p class="1">1</p>
<p class="2">2</p>
<p class="3">3</p>
</div>
</div>
As I understand you want to get the value of the text input without p tags you can do it using jquery by following jquery script
data = $("#data").val();alert($(data).text()); </pre>
or by PHP using $data = $_GET ['data']; echo strip_tags($data);