0

I'm trying to add a delete button to a custom div. However when the page is loaded, the jquery mobile button does not take the format of jquery and displays it like a hyperlink.

var currDelButton = $("<a>").attr("href","#").attr("data-role","button").attr("data-icon","delete").attr("data-iconpos","left").text("حذف");

anyone has an idea about this issue?

Best Regards Ali

1
  • What event is this wrapped in ? What's the code for your "page is loaded"? Commented Sep 4, 2012 at 17:09

2 Answers 2

1

If you are adding the button after the page is loaded then you need to refresh the element for example $("#mybutton").button(); should work.

here is a working example with the code you provided: http://jsfiddle.net/ashanova/RQVd8/1/

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

3 Comments

Thanks, that solved the problem. This was done in the pageshow event.
Can you explain the reason please
anything that is injected or dynamically created after pageinit event needs to be initialised
1

call the .page for the main wrapper where new buttons are added.

$("#content").page();

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.