Jquery don't work inside php echo : value of $qty is in my database. I've read few similar questions and I already added $(document).ready(function() but still not working.

                echo "
                     <div class='sp-quantity'>
						<div class='sp-minus fff'><a class='ddd' href='#' data-multi='-1'>-</a></div>
						<div class='col-xs-3 sp-input'>
						<input type='text' class='quntity-input form-control qty' pid='$bookid' id='qty-$bookid' value='$qty'/>
						</div>
						<div class='sp-plus fff'><a class='ddd' href='#' data-multi='1'>+</a></div>
						</div>


                ";

      	        echo "<script>";
				echo "$(document).ready(function(){";
				echo "$('.ddd').on('click', function() {";
				echo "var $button = $(this);";
				echo "var $input = $button.closest('.sp-quantity').find('input.quntity-input');";
				echo "$input.val(function(i, value) {";
				echo "return +value + (1 * +$button.data('multi'));";
				echo "});";
				echo "});";
				echo "});";
				echo "</script>";




