Like the question says, I am trying to capture a click on a textbox that is disabled.
Now, there may be a better way to do this, but right now I don’t know it. Basically I have a textbox that is disabled sitting in a div. It is merely a placeholder. I have an event that captures the click on anywhere within it’s parent div. Because the textbox is disabled, this does not work.
Does anyone know of a way to either:
- Keep textbox enabled but don’t allow the user to enter any input or display a cursor. (Essentially make it just a static textbox that the user can’t interact with at all)
or
- Disable textbox like I am now, but continue to capture the click events.
This is what the input looks like:
<li id="test_id" class="selected">
<label id="" for=""> Untitled</label>
<input id="text" type="textbox" name="default" disabled="disabled">
<div class="field_actions">
<span class="propertiesTip"></span>
</li>
and this is what the click event handler looks like:
$('#parent').on('click' , 'li, label, textbox', function (event) { /*...*/ }
This handles a click anywhere inside the div. It doesn’t work on the textbox if it is disabled. Anyone encounter this before and have a solution? Thanks in advance
I know this was mentioned, but I would use read only. You can use CSS to style it to look disabled, and even to change the cursor to whatever you want like so: