Wednesday, January 24, 2018

jquery - How to check whether the content of the field contains part of the second field?

I have a code that checks if both fields have the same value:



$ampD.blur(function() {
setInterval(update, 1000);


function update() {
if ($('input#autocompletegoogle').attr('value') == $('input#field-address').attr('value')) {
$ampD.attr('style', '');
} else {
$ampD.attr('style', 'border: 1px solid #f00!important;background: #ffefef !important');
}


But sometimes $('input#autocompletegoogle') contains additionals marks example:




"5611JM Eindhoven, Netherlands"


but input#field-address contains "Eindhoven, Netherlands" and I get false.



How can I check in whether $('input#autocompletegoogle') contains value from $('input#field-address')?



I tried to find the solution almost one hour... I could find right information. Somone could help me?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...