How to change the textfield cursor colour in Cordova iOS project

北城以北 提交于 2019-12-06 11:15:31

Sujania - you just need to add the class "cursor" to your input type.

<input class="cursor" type="text" placeholder="First Name" id='regFName' />

Then the CSS will apply as you would expect!

Suresh Ratten

Solution 1: Setting the android:textCursorDrawable attribute to @null should result in the use of android:textColor as the cursor color.

Attribute textCursorDrawable is available in API level 12 and higher


Solution 2: With iOS 7 you can simply change tintColor property of the UITextField. This will affect both the color of the text cursor and the text selection highlight color.

You can do this in code...

textField.tintColor = [UIColor redColor];
... or in Interface Builder:


Solution 3: In your EditText properties, there is an attribute android:textCursorDrawable

Now set it to @null like,

android:textCursorDrawable="@null"

So now your EditText Cursor is same as your EditText TextColor.


Solution 4: Use an image along with CSS cursor property, I don't see any need of JavaScript here...

div {
   cursor: url(YOUR_IMAGE_URL), auto;
}
Rajesh Kumar Patel

To change the color of the cursor, write css for the cursor as follows:

.cursor {
        font-size: 12px;
        background-color: red;
        color: red;
        position: relative;
        opacity: 0.5;
       }

try this ,

for background-color user ur screen background color and for colore use white colore

<style>
 .cursor {
     font-size: 12px;
    background-color: blue;
    color: #fff;
    position: relative;
    opacity: 0.5;
   }
</style>
<input class="cursor " type="text" name="firstname">code here

hope this will work for u!!

Try the css attribute caret-color, it's working for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!