twitter bootstrap - BootstrapSwitch not working -
I do not have a simple yes switch that is not showing as it is showing as a checkbox
& lt;% = f.label: true, "right answer?" % & Gt; & Lt; Br> & lt;% = f.check_box: true% & gt; & Lt; Script & gt; $ (Document) .ready (function () {$ ("# answer_correct"). Bootstrap switch ('ontxt', 'yes'); $ ("# answer_correct"). Bootstrap switch (' off-test ',' no '); $ ("#answer_correct"). Bootstrap switch (' size ',' big ');}); & Lt; / Script & gt; This console's information is:
& lt; Input id = "question_reference_accident_character" name = "question [answer_username] [0] [right]" type = "checkbox" value = "1" & gt; Am I missing something? Thank you.
The JQuery ID selector is not referring to the input element on the page.
Change $ ("# answer_correct") to select from the correct ID: $ ("# query_station_accident__right") / P> or
$ ("[name = 'question [answers_attributes] [0] [right]']") to select element by its name for.
Comments
Post a Comment