javascript - There is no bug in those two jQuery statements but I am just wondering why -


the following work perfectly

sendtext5 = "homer simpson";  $eraser.prop('value', sendtext5);  $.mobile.pagecontainer.pagecontainer( "change", $article2 ); 

but not following

sendtext5 = "homer simpson";  $.mobile.pagecontainer.pagecontainer( "change", $article2 );  // line executes  $eraser.prop('value', sendtext5);   // line not execute  

$article2 div tag , $eraser input tag.

i wondering why second situation works first does.

it jquery 2.1.1 , jquery mobile 1.4.5

thanks lot, stack overflow!

i'm assuming $eraser element within $article2. if it's not, answer worthless.

in first example, setting property before jqm enhances layout.

in second example, setting after layout enhanced. means changing value property, on underlying form element. need tell jqm re-render displayed element.

if $eraser text box, try following:

sendtext5 = "homer simpson"; $.mobile.pagecontainer.pagecontainer( "change", $article2 ); // line executes $eraser.prop('value', sendtext5);   // line execute, on underlying element $eraser.textinput( "refresh" ); // line refreshes displayed element underlying elements's properties 

Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -