Wednesday, 24 January 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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...