im trying grab variable separate php file jquery if
statement (i'm wondering how can import php file jquery)
(the script count characters in textarea
)
current code:
$( document.body ).ready(function() { $('#message-input').live('keyup',function(){ if ($message == 0) { $('#message-count').html('enter @ least 14 characters'); } var count = ($(this).val().length); if ($message < 20 && $message > 1) { $('#message-count').html('enter atleast more ' + count + ' characters'); } var remaining = 1000 - ($(this).val().length); if ($message > 20) { $('#message-count').html(remaining +' more characters go'); } }) })
if jquery
codes written inside php
file, can this
// inside yourfile.php // pass php var js var var message = <?php echo $message ?>; // can use var message here... $( document.body ).ready(function() { $('#message-input').live('keyup',function(){ // if ($message == 0) { if (message == 0) { $('#message-count').html('enter @ least 14 characters'); } var count = ($(this).val().length); // if ($message < 20 && $message > 1) { if (message < 20 && message > 1) { $('#message-count').html('enter atleast more ' + count + ' characters'); } var remaining = 1000 - ($(this).val().length); // if ($message > 20) { if (message > 20) { $('#message-count').html(remaining +' more characters go'); } }) })
Comments
Post a Comment