0

I started experimenting with MVC 3. And I'm stuck with applying the style of an input-button.

Is it possible to apply Css in the View? The code I gave is located in the View.

<input id="newSubItem" type="button" onclick="location.href='javascript:void(0);'" value='New Subitem' /><br/>

2 Answers 2

3

Did you try

 <input id="newSubItem" class="myCSSClass" type="button" onclick="location.href='javascript:void(0);'" value='New Subitem' />
Sign up to request clarification or add additional context in comments.

5 Comments

I'm using jqModal and i need the class-attribute to close the jqModal dialog by setting the value of class to jqmClose.
Actually this is a separate question, can you please create another question for this. Because for this I will need to change my answer, and currently my answer solves your current question. Thanks
you can use this notation $("#newSubItem").removeClass("myCSSClass").addClass("jqmClose"); once your jqModal closes.
Here is the other question: stackoverflow.com/questions/9160386/…
As promised here is your answer: stackoverflow.com/questions/9160386/… :)
1

You have to put link in the view to your css page :

 <link href="@Url.Content("~/CSSPAGE.css")" rel="stylesheet" type="text/css" />

And then you can apply any class you want,for example

<input id="newSubItem" class="CSSClass1" type="buttononclick="location.href='javascript:void(0);'" value='New Subitem' />

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.