Reputation: 4245
This is my attempt at my question
I have a search box (HTML):
<form method="post">
Search:<input type="text" name="search">
<input value="Search" type="submit">
</form>
I then have php:
$search = $_POST["search"];
And then Jquery:
$(function() {
var foundin = $('li:contains(" /* I want this part to be the bit entered by the form... $search */ ")').css( "color", "red" );
});
But I can't seem to get the php into jQuery.
Upvotes: 1
Views: 66
Reputation: 1870
Try changing it to :
$(function() {
var foundin = $('li:contains(" <?php echo $search ?> ")').css( "color", "red" );
});
Upvotes: 1
Reputation: 2220
$(function(){
var foundin = $('li:contains("<?php echo $search; ?>").css("color", "red");
Upvotes: 1