1,105,352 Community Members

insert image

Member Avatar
TKO
Junior Poster in Training
93 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

All i would like to do is insert an image next to the question. Im sure this is a very easy thing to do. I just cant seem to do it.
any help would be great, thank you

    '<input type="hidden" name="questions[' + n + '][number]" value="' + n + '" />' +
                '<b><u><p>question :' + (n+1) + '</p></u</b><input type="text" name="questions[' + n + '][name]" />' +     
                      '<input type="hidden" name="questions[' + n + '][running]" value="Y" />' + 
Member Avatar
radow
Junior Poster in Training
73 posts since Oct 2012
Reputation Points: 7 [?]
Q&As Helped to Solve: 18 [?]
Skill Endorsements: 1 [?]
 
0
 

Where will execute your code?

Member Avatar
JorgeM
IT Addict
6,387 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 956 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

I think we need more of your code to get a better picture of what you are trying to do.

Member Avatar
TKO
Junior Poster in Training
93 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for the reply, here is the whole js file.
I would like to add an image next to the question.
uploads/1image.png is the location of the image file.

function scoreboard_general()
{
    // handler for our custom form buttons
    $('form span.button.submit').click(function(){
        $(this).parents('form').submit()
    })

}

function scoreboard_mark()
{
    // handler for table row & correct answer highlights
    $('table#entries tbody tr')
        // table row hover: on
        .mouseover(function(){
            $(this).addClass('over')
        })
        // table row hover: off
        .mouseout(function(){
            $(this).removeClass('over')
        })
        // table row select: highlight and show tick
        .click(function(){
            if( $(this).is('.selected') ) {
                // deselect row
                $(this)
                    .removeClass('selected')
                    .find('input[name*="[correct]"]').val('N')
            }
            else {
                // select row
                $(this)
                    .addClass('selected')
                    .find('input[name*="[correct]"]').val('Y')
            }
        })

    // handler for 'select all'
    $('span.button#select-all').click(function(){
        $('table#entries tbody tr')
            .addClass('selected')
            .find('input[name*="[correct]"]').val('Y')
    })

    // handler for 'select none'
    $('span.button#select-none').click(function(){
        $('table#entries tbody tr')
            .removeClass('selected')
            .find('input[name*="[correct]"]').val('N')
    })

    // handler for matching string
    $('form#controls').submit(function(){
        var keyword = $(this).find('input#quickmark-text').val().toLowerCase()
        if ( keyword.length > 0 )
        {
            $('table#entries tbody tr:has(td.answer)').each(function(){
                var td = $(this).find('td.answer').text().toLowerCase()
                if ( td.indexOf(keyword) != -1 )
                    $(this)
                        .addClass('selected')
                        .find('input[name*="[correct]"]').val('Y')
            })
        }
        return false
    })



}

function scoreboard_login()
{
    $('fieldset#login input#password').focus()
}

function scoreboard_setup()
{
    $('form#question-setup fieldset:last input[type="text"]').focus()

    // handler for adding/removing questions
    $('#question-add').click(function(){
        var n = $('form#question-setup fieldset').size()


        // new question fieldset

        $('form#question-setup fieldset:last')
            .after('<fieldset style="display:none;"><legend>Question ' + (n+1) + '</legend>' +



                '<input type="hidden" name="questions[' + n + '][number]" value="' + n + '" />' +
                '<b><u><p>Question :' + (n+1) + '</p></u</b><input type="text" name="questions[' + n + '][name]" />' +     
                      '<input type="hidden" name="questions[' + n + '][running]" value="Y" />' +                     




'<div class="question-remove" title="Remove this Questiont"></div>' +
                '</fieldset>')

        // get newly added fieldset
        var form = $('form#question-setup')
        var fieldset = form.find('fieldset:last')

        // animates new fieldset
        fieldset.slideDown(200, function(){
            // focus new question field
            fieldset.find('input[type="text"]').focus()
        })


        // handler for removing this question fieldset
        fieldset.find('div.question-remove').click(function(){
            // hide the fieldset
            $(this).parents('fieldset').slideUp(200, function(){
                // remove the fieldset
                $(this).remove()
                // renumber the remaining fieldsets
                form.find('fieldset').each(function(i){
                    $(this).find('legend').text('Question ' + (i+1))
                    $(this).find('input[name$="[number]"]')
                        .attr('name', 'questions[' + i + '][number]')
                        .attr('value', i)
                    $(this).find('input[name$="[name]"]')
                        .attr('name', 'questions[' + i + '][name]')
                    $(this).find('input[name$="[running]"]')
                        .attr('name', 'questions[' + i + '][running]')
                        $(this).find('input[name$="[number]"]')
                        .attr('name', 'Question1[' + i + '][number]')
                        .attr('value', i)
                    $(this).find('input[name$="[name]"]')
                        .attr('name', 'Question1[' + i + '][name]')
                    $(this).find('input[name$="[running]"]')
                        .attr('name', 'Question1[' + i + '][running]')                      
                })
            })
        })
    })

}
Member Avatar
TKO
Junior Poster in Training
93 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Any thoughts ?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article