Sunday, 15 January 2012

javascript - Add CSS on click of a disabled button -


After various other posts I have disabled a submit button, unless the form has not been selected.

What do I want to do, when the disabled button is clicked, highlight the selection box. I am thinking of the easiest way to do this, with a click function, CSS border color is applied in the selection box. But I'm not sure how to achieve this.

My script goes so far:

  $ ('# submitorder'). Prop ('disabled', true); Function updated formatted () {if (verification edits ()) {$ ('# submitorder'). Prop ('incompetent', false); } And {$ ('# submitorder'). Prop ('disabled', true); }} Function verifyAdSettings () {if ($ ('$ course1choice'). Val ()! = '' & Amp; $ ('# course2choice'). Val ()! = '') {True; } Else {return false}} $ ('# course1choice'). Change (updateFormEnabled); $ ('# Course2choice') change (updateFormEnabled)  

My HTML:

  & lt; Form id = "productchoices" & gt; & Lt; Choose name = "92" id = "course1choice" & gt; & Lt; Option value = "" & gt; Select Course 1 & lt; / Option & gt; & Lt; Option value = "659" & gt; Lesson plan & lt; / Options & gt; & Lt; Option value = "660" & gt; Teaching from a & lt; / Options & gt; & Lt; Option value = "661" & gt; Teaching Users & lt; / Option & gt; & Lt; Option value = "662" & gt; Teaching young learners & lt; / Option & gt; & Lt; / Select & gt; & Lt; Select Name = "91" id = "Course 2 Choice" & gt; & Lt; Option value = "" & gt; Choose Course 2 & lt; / Option & gt; & Lt; Option value = "655" & gt; Lesson plan & lt; / Options & gt; & Lt; Option value = "656" & gt; Teaching from a & lt; / Options & gt; & Lt; Option value = "657" & gt; Teaching Users & lt; / Option & gt; & Lt; Option value = "658" & gt; Teaching young learners & lt; / Option & gt; & Lt; / Select & gt; & Lt; Button type = "submit" id = "submitorder" & gt; Book now & lt; / Button & gt; & Lt; / Form & gt;  

Please refer to the examples below for modifying some examples.

  & lt; Form id = "productchoices" & gt; & Lt; Select name = "92" id = "course1choice" class = "likes" & gt; & Lt; Option value = "" & gt; Select Course 1 & lt; / Option & gt; & Lt; Option value = "659" & gt; Lesson plan & lt; / Options & gt; & Lt; Option value = "660" & gt; Teaching from a & lt; / Options & gt; & Lt; Option value = "661" & gt; Teaching Users & lt; / Option & gt; & Lt; Option value = "662" & gt; Teaching young learners & lt; / Option & gt; & Lt; / Select & gt; & Lt; Select Name = "91" id = "Course 2 Choice" category = "Like" & gt; & Lt; Option value = "" & gt; Choose Course 2 & lt; / Option & gt; & Lt; Option value = "655" & gt; Lesson plan & lt; / Options & gt; & Lt; Option value = "656" & gt; Teaching from a & lt; / Options & gt; & Lt; Option value = "657" & gt; Teaching Users & lt; / Option & gt; & Lt; Option value = "658" & gt; Teaching young learners & lt; / Option & gt; & Lt; / Select & gt; & Lt; Button type = "submit" id = "submitorder" & gt; Book now & lt; / Button & gt; & Lt; / Form & gt; $ (Document) .ready (function () {$ ("# submitorder") .prop ("disabled", true); $ ('.choice'). ('Change', function () {if ($ ( Pro) ("disabled", false);) () "" ("disabled", true);} and {$ ("# submitorder").});  

}) ;

Let me know if there is a query.


No comments:

Post a Comment