I have a date text box and in that I have use placeholder which displays dd/mm/yyyy
on click of textbox it display a value="dd/mm/yyyy" ,and for that I have used mask input plugin my query is I want to change the color of the number which I'm typing, keeping remaining content color unchanged. how can we do this.
Please, see this screenshot for reference.
I tried on keypress to change color but changes everything present in the input.
Something cool? check this jsfiddle this will change color depends on value on whatever you want
$('.getvalueofinput').keydown(function() { var value1, value2; value1 = $('.getvalueofinput').val(); value2 = $('.equalvalue').text(); if (value1 == value2) { alert('equal'); $('.getvalueofinput').css('background-color', 'brown').css('color','white'); } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type=text class="getvalueofinput"> <span class='equalvalue' value='write me'>write me</span>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.