0

I've got a form (using jQueryUI tabs), where I want the text input elements with readonly="readonly" to have a CSS value of border:0;. So far I've got (using the jQuery docs):

$(":input[type='text'][readonly='readonly']").each(function()
{
    $(this).css('border', '0;');
});

Which doesn't do anything at all. When I add $(document).ready() to the above, my jQuery tabs break (but the sliders don't). If I only have $(document).ready() with no content, it's fine. I think the issue lies within the first line, but I'm not sure.

I don't want to do this with id/class. If it's possible to do only with CSS, that'd be great, but I can't think of a way.

3 Answers 3

6

How about a simple css

input[readonly] { border-width: 0px; }
Sign up to request clarification or add additional context in comments.

2 Comments

sigh Here I go again, making things 10x harder for myself. Thanks for the quick (and easy) response.
Also always fire up firbeug and try out your selectors in the console. Will save you a lot of headaches if you know whether or not your jQuery selectors are actually returning anything.
1

Plain CSS declaration aside, your ":input[type='text'][readonly='readonly']" seems to have a stray leading colon : which actually designates a pseudoclass (and input is a tag name). Also, try removing the trailing ; in '0;' (or use '0px' instead).

Comments

1
$("input[type='text'][readonly='readonly']").each(function(){
    $(this).css('border', '0');
});

JSFiddle

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.