Raja O
Raja O

Reputation: 644

In jQuery Mobile how to overide the close button href in Poup Dialog

I want to change href in popup(dialog) close button. jQuery Mobile Automatically generate the href="#". I want to override the href="myPage". How can i override the href=""

Code

 <div data-role="dialog" id="pageId">
    <div data-role="header" data-theme="c">
      <h2>your Heading</h2>
    </div>
    <div data-role="content">
        <p>Your Message.</p>
     </div>
 </div>

In this code jQuery automatically generating code for the close button. How to i override the href="#" into my href="".

if i click the close(X) button it want to goes to my link page.

Can any one help me with good solution. Thanks

Upvotes: 2

Views: 1030

Answers (2)

Carls Jr.
Carls Jr.

Reputation: 3078

You can do this

$('#ElementID').attr("href","http://www.yournewurl.com");

Upvotes: 1

imwill
imwill

Reputation: 598

The automatically generated close button usually doesn't have an ID.

Try this:

$('a[title="Close"]').attr("href","http://www.yournewurl.com");

Update

I made a quick working example: http://jsfiddle.net/dYB3a/2/

Upvotes: 1

Related Questions