1

I want to send the value of property_name to headline and property_name_thumb when a user types in property_name. I works when I only use one but not both?

$('#property_name').bind('keyup keypress blur', function() 
{  
    $('#headline','#property_name_thumb').val($(this).val()); 
});

2 Answers 2

4
$('#headline, #property_name_thumb').val($(this).val());

All in one string!

Sign up to request clarification or add additional context in comments.

Comments

0

You're closing the string after headline, so you're passing two parameters instead of one. Use joakimdahlstrom's code instead:

$('#headline, #property_name_thumb').val($(this).val()); });

The way you did, the first parameter was the selector and the second was the context (kind of a "filter" to your selector - will only select descendants of the context). Since headline was not a descendant to property_name_thumb, nothing was selected at all, so your code didn't run.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.