I'm using Mozlla Firefox vesrion 24.01
.
I've a text box
input field in my form whics is read only. In Mozilla, I could see a cursor blinking inside textbox when pointing to that text box, but in Chrome, it is not.
Is there any way to not to have cursor shown in Mozilla also?
I've searched for it a lot, and have seen some answers regarding this like to put
onfocus="this.blur();"
as inline inside the input field. But, this works in HTML. When I tried with Rails text_field_tag
it is not taking the method 'onfocus
'. So, either please suggest me a better solution to hide the cursor or tell me how I can achieve it with text_field_tag
and onfocus
event.
Thanks for any help :)
Suggestion from CBroe worked. But, in a Rails way,
<%= text_field_tag "answer_name",truncate(answer.name,:length=>35), :onfocus => "this.blur();", :style=>"cursor:default;", :readonly => true%>
It worked. Don't forget to put the CSS line 'cursor: default;' will change the pointer to arrow type as by default, a text box will have text-mode pointer (The pointer type that you can see while putting answer in SO through this area).
This won't work in IE
. So, better replace the text_field
with div
element and make the text_field a hidden field
to carry out the operations.