0

I think the below problem is something to do with escaping strings, but i'm hoping someone will confirm that.

i need to append event.id to the submit value like so: /Events/Edit/ + event.id. There is definitely content in the event.id property as it displays correctly the second time i use it.

$('.ui-dialog div.ui-dialog-buttonpane')
    .append('<button type="submit" value="/Events/Edit/"'  
            + event.id 
            + ' class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" ><span class="ui-button-text">' 
            + event.id + '</span></button>');

3 Answers 3

5

i think your problem may be that you have value="/Events/Edit/"'+ event.id You probably meant value="/Events/Edit/'+ event.id +'" [the rest of your snippet]

Sign up to request clarification or add additional context in comments.

Comments

2

You just need to move the double quote to after you append the event id (broke things up a little more to make it more readable):

$('.ui-dialog div.ui-dialog-buttonpane')
    .append('<button type="submit" value="/Events/Edit/'
        + event.id 
        + '" class="ui-button ui-widget ui-state-default '
        + 'ui-corner-all ui-button-text-only" ><span class="ui-button-text">' 
        + event.id + '</span></button>');

Comments

1

Move the " forward to after event.id:

$('.ui-dialog div.ui-dialog-buttonpane').append('<button type="submit" value="/Events/Edit/'  + event.id + '" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" ><span class="ui-button-text">' + event.id + '</span></button>');

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.