user3350169
user3350169

Reputation: 209

how to add a popup for click event?

I am using jquery mobile 1.4.2.

I want to add a popup instead of alert.

HTML

 <input name="im_price" type="text" class="positive_integer ayudas" id="im_price"  value="" />

script

  $(document).ready(function() {
  $('#im_price').click(function(){
      alert('Digite el precio total de venta y/o alquiler de su propiedad. Si   desea informar acerca de precio(s) por unidad de medida (mt², hectáreas, etc.) puede incluirlo en la Descripción.');
  });
    });

When user click on it shows the help text about what are all the things user should right in this field.I want this to show a pop up instead of alert.

Here is the jsfiddle http://jsfiddle.net/XruE5/

Upvotes: 1

Views: 59

Answers (1)

Gajotres
Gajotres

Reputation: 57309

Working example: http://jsfiddle.net/5ebp7/

HTML:

<input name="im_price" type="text" class="positive_integer ayudas" id="im_price"  value="" />
<div data-role="popup" id="popupBasic">
    <p>Digite el precio total de venta y/o alquiler de su propiedad. Si desea informar acerca de precio(s) por unidad de medida (mt², hectáreas, etc.) puede incluirlo en la Descripción.</p>
</div>

JavaScript:

$(document).ready(function() {
    $('#im_price').click(function(){
        $('#popupBasic').popup('open');
    });
});

Upvotes: 1

Related Questions