Hi all,
Been working on this piece of code for about 4 hours now, can't get it to work! I genuinely don't know why - I've been looking at it and have no idea what's wrong. Have been stubbornly trying not to ask for help, but now I give up. Can anyone see the problem in this code:
- $(function () {
- $('.multi').click(function(){
- $(this).closest('.full-width')
- .after('<div class="row full-width"> <div class="triangle"> </div> <div class="gridfix"> <div class="medium-12 columns section center"> <h1> What are the options? </h1> <input id="inputtrigger" type="text" placeholder="Type in a choice" /> <input class="button white hidden addquestion" type="submit" value="Add Question to Survey" /> </div> </div> </div>');
- })
- })
Here's the html:
- <div class="row full-width ghost hidden grey typedummy">
- <div class="triangle"> </div>
- <div class="gridfix">
- <div class="medium-12 columns section center">
- <h1> What kind of question is it? </h1>
- <a class="button multi">Multiple Choice with one answer</a>
- <a class="button multi">Multiple Choice tick all that apply</a>
- <a class="button">Text Field</a>
- <a class="button">Rating</a>
- </div>
- </div>
- </div>
- </div>
Pointers much appreciated!
EDIT: It just occurred to me that the code might not be working because the html above had been cloned in using this code:
- var seashell = 0;
- var klon = $( '#question'+ seashell );
- $(function() {
- $('.addnew').click(function(event){
- $(this).after('<h5> Question 1 of 1 currently being edited </h5>').css("display", "none");
- $('.full-width').toggleClass('grey');
- klon.clone().attr('id', 'question'+(++seashell) ).insertBefore('#newq');
- });
- });
I don't know enough to know whether that's an issue or not. Could it be being excluded from jQuery's scope of reach because it wasn't there on $(document).ready ?
Thanks